FunctionType
- JavaScript function typeContextType
- JavaScript contextpublic class JSSynthclipse<FunctionType,ContextType> extends Object
JSSynthclipse
instance is available as global object named: Synthclipse.Constructor and Description |
---|
JSSynthclipse(org.synthclipse.scripting.AbstractJSExecutor<FunctionType,ContextType> jsExecutor)
Creates a new
JSSynthclipse instance. |
Modifier and Type | Method and Description |
---|---|
void |
addAnimationListener(Object jsObject)
Adds animation listener object.
|
void |
addKeyListener(Object jsObject)
Adds key listener object.
|
void |
addMouseListener(Object jsObject)
Adds mouse listener object.
|
void |
createControls(GLSLProgram program)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
program . |
void |
createControls(GLSLProgram program,
boolean visible)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
program . |
void |
createControls(GLSLProgram program,
boolean visible,
boolean trackEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
program . |
void |
createControls(GLSLProgram program,
boolean visible,
boolean trackEvents,
boolean emitEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
program . |
void |
createControls(JSFragxRenderer fragxRenderer)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
fragxRenderer . |
void |
createControls(JSFragxRenderer fragxRenderer,
boolean visible)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
fragxRenderer . |
void |
createControls(JSFragxRenderer fragxRenderer,
boolean visible,
boolean trackEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
fragxRenderer . |
void |
createControls(JSFragxRenderer fragxRenderer,
boolean visible,
boolean trackEvents,
boolean emitEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in the
fragxRenderer . |
void |
createScriptControls()
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in current JSX script.
|
void |
createScriptControls(boolean visible)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in current JSX script.
|
void |
createScriptControls(boolean visible,
boolean trackEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in current JSX script.
|
void |
createScriptControls(boolean visible,
boolean trackEvents,
boolean emitEvents)
Creates in the Uniform Controls View a tab with UI elements/widgets, which control uniform variables contained
in current JSX script.
|
JSTimer |
createTimer()
Creates a new instance of
JSTimer class. |
int |
getMusicTextureID()
Gets music OpenGL texture's ID.
|
IRecordingInfo |
getRecordingInfo()
Gets recording info.
|
double |
getSystemTime()
Gets system time in seconds.
|
double |
getTime()
Gets animation time (from the Rendering View) in seconds.
|
int |
getTrueViewportHeight()
Gets true/physical Viewport's height.
|
int |
getTrueViewportWidth()
Gets true/physical Viewport's width.
|
int |
getViewportHeight()
Gets the Viewport's height.
|
int |
getViewportWidth()
Gets the Viewport's width.
|
boolean |
isAnimationPaused()
Is animation paused?
|
boolean |
isAnimationPlaying()
Is animation playing?
|
boolean |
isAnimationStopped()
Is animation stopped?
|
boolean |
isDebugMode()
Checks whether Debug Mode is enabled.
|
boolean |
isRecording()
Checks whether Synthclipse is recording current script.
|
void |
load(String scriptPath)
Loads and executes a JavaScript file.
|
JSFragxRenderer |
loadFragx(String filePath)
Loads
.fragx/.stoy shader file. |
boolean |
loadPreset(String presetName)
Loads preset.
|
TextureWrapper |
loadTexture(String path)
Loads texture file.
|
double |
random()
Generates a random value between
0.0 (inclusive) and 1.0 (exclusive). |
double |
random(double min,
double max)
Generates a random value between
min (inclusive) and max (exclusive). |
ByteBuffer |
readBinaryFile(String filePath)
Reads a binary file.
|
String |
readFile(String filePath)
Reads a text file with "UTF-8" encoding.
|
String |
readFile(String filePath,
String encoding)
Reads a text file with user selected encoding.
|
void |
refreshControls()
Refreshes all tabs in the Uniform Controls View.
|
void |
removeAllControls()
Removes from the Uniform Controls View all tabs.
|
void |
removeControls(GLSLProgram program)
Removes from the Uniform Controls View a tab with UI elements/widgets, which uniform variables contained
in the
program . |
void |
removeControls(JSFragxRenderer fragxRenderer)
Removes from the Uniform Controls View a tab with UI elements/widgets, which uniform variables contained
in the
fragxRenderer . |
File |
resolveFile(String path)
Resolves specified path.
|
void |
setDebugMode(boolean debugMode)
Enables or disables Debug Mode.
|
void |
setGLVersion(int major,
int minor)
Sets OpenGL version used in the script.
|
void |
setRenderable(Object jsObject)
Sets Renderable object.
|
public JSSynthclipse(org.synthclipse.scripting.AbstractJSExecutor<FunctionType,ContextType> jsExecutor)
JSSynthclipse
instance.public void addMouseListener(Object jsObject) throws org.synthclipse.core.SynthclipseException
jsObject
should be a JavaScript object
containing one or more of the following functions: function mouseUp(mouseEvent) {}
function mouseDown(mouseEvent) {}
function mouseMove(mouseEvent) {}
function mouseScrolled(mouseEvent) {}
mouseEvent
- of these functions is an instance of
org.eclipse.swt.events.MouseEvent
class.jsObject
- a JavaScript object with mouse event handler methodsorg.synthclipse.core.SynthclipseException
- when jsObject
does not contain any of above JavaScript functions
or when those functions have wrong definitions (e.g. invalid argument count).public void addKeyListener(Object jsObject) throws org.synthclipse.core.SynthclipseException
jsObject
should be a JavaScript object
containing one or more of the following functions: function keyPressed(keyEvent) {}
function keyReleased(keyEvent) {}
keyEvent
- of these functions is an instance of
org.eclipse.swt.events.KeyEvent
class.jsObject
- a JavaScript object with key event handler methodsorg.synthclipse.core.SynthclipseException
- when jsObject
does not contain any of above JavaScript functions
or when those functions have wrong definitions (e.g. invalid argument count).public void addAnimationListener(Object jsObject) throws org.synthclipse.core.SynthclipseException
jsObject
should be a JavaScript object
containing one or more of the following functions: function onPlay() {}
function onPause() {}
function onStop() {}
jsObject
- a JavaScript object with animation event handler methodsorg.synthclipse.core.SynthclipseException
- when jsObject
does not contain any of above JavaScript functions
or when those functions have wrong definitions (e.g. invalid argument count).public void setRenderable(Object jsObject) throws org.synthclipse.core.SynthclipseException
jsObject
should be a JavaScript object
containing one or more of the following functions: function init() {}
function lateInit() {}
function display() {}
function resize(width, height) {}
width
and height
are Viewport's width and Viewport's height, respectively.function destroy() {}
jsObject
- a JavaScript object with script life cycle methodsorg.synthclipse.core.SynthclipseException
- when jsObject
's functions have wrong definitions (e.g. invalid argument count).public boolean isDebugMode()
public void setDebugMode(boolean debugMode)
debugMode
- true
enables Debug Mode, false
disables Debug Modepublic double getTime()
Synthclipse.getTime();
Synthclipse.time;
getSystemTime()
public double getSystemTime()
Synthclipse.getSystemTime();
Synthclipse.systemTime;
getTime()
public int getMusicTextureID()
Synthclipse.getMusicTextureID();
Synthclipse.musicTextureID;
public double random()
0.0
(inclusive) and 1.0
(exclusive).public double random(double min, double max)
min
(inclusive) and max
(exclusive).min
- minimal boundary (inclusive)max
- maximal boundary (exclusive)public void setGLVersion(int major, int minor) throws org.synthclipse.core.SynthclipseException
major
- Major part of the OpenGL version. (e.g. "4" from "OpenGL 4.3").minor
- Minor part of the OpenGL version (e.g. "3" from "OpenGL 4.3").org.synthclipse.core.SynthclipseException
- when requested OpenGL's version is not supported.public void load(String scriptPath) throws org.synthclipse.core.SynthclipseException
scriptPath
- path to the JavaScript file.org.synthclipse.core.SynthclipseException
- when the script file does not exist or there are errors
in the script.public String readFile(String filePath) throws FileNotFoundException
filePath
- path to the text fileFileNotFoundException
- when the file does not exist.public String readFile(String filePath, String encoding) throws FileNotFoundException
filePath
- path to the text fileencoding
- text encoding (e.g. "UTF-8", "UTF-16", "ISO-8859-1")FileNotFoundException
- when the file does not exist.public ByteBuffer readBinaryFile(String filePath) throws IOException
IOException
public File resolveFile(String path) throws FileNotFoundException
FileNotFoundException
public TextureWrapper loadTexture(String path) throws javax.media.opengl.GLException, IOException
path
- texture's pathTextureWrapper
instancejavax.media.opengl.GLException
- when OpenGL's texture creation failsIOException
- when the file cannot be readpublic JSFragxRenderer loadFragx(String filePath) throws FileNotFoundException, org.synthclipse.core.SynthclipseException
.fragx/.stoy
shader file.filePath
- path to the fileJSFragxRenderer
instanceFileNotFoundException
- when the file does not existorg.synthclipse.core.SynthclipseException
- when the .fragx/.stoy
script contains errorspublic void createScriptControls()
createScriptControls(true, true, true);
public void createScriptControls(boolean visible)
createScriptControls(visible, trackEvents, true);
visible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewcreateScriptControls(boolean, boolean, boolean)
public void createScriptControls(boolean visible, boolean trackEvents)
createScriptControls(visible, true, true);
visible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupscreateScriptControls(boolean, boolean, boolean)
public void createScriptControls(boolean visible, boolean trackEvents, boolean emitEvents)
visible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupsemitEvents
- if true the Uniform Control variables (UCs) will emit a synchronization events,
which can be captured by other UCs with the same names and groups to force their synchronizationpublic void createControls(JSFragxRenderer fragxRenderer)
fragxRenderer
. Equivalent of: createControls(fragxRenderer, true, true, true);
fragxRenderer
- a .fragx/.stoy
renderercreateControls(JSFragxRenderer, boolean, boolean, boolean)
public void createControls(JSFragxRenderer fragxRenderer, boolean visible)
fragxRenderer
. Equivalent of: createControls(fragxRenderer, visible, true, true);
fragxRenderer
- a .fragx/.stoy
renderervisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewcreateControls(JSFragxRenderer, boolean, boolean, boolean)
public void createControls(JSFragxRenderer fragxRenderer, boolean visible, boolean trackEvents)
fragxRenderer
. Equivalent of: createControls(fragxRenderer, visible, trackEvents, true);
fragxRenderer
- a .fragx/.stoy
renderervisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupscreateControls(JSFragxRenderer, boolean, boolean, boolean)
public void createControls(JSFragxRenderer fragxRenderer, boolean visible, boolean trackEvents, boolean emitEvents)
fragxRenderer
.fragxRenderer
- a .fragx/.stoy
renderervisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupsemitEvents
- if true the Uniform Control variables (UCs) will emit a synchronization events,
which can be captured by other UCs with the same names and groups to force their synchronizationpublic void createControls(GLSLProgram program)
program
. Equivalent of: createControls(program, true, true, true);
program
- a GLSL programcreateControls(GLSLProgram, boolean, boolean, boolean)
public void createControls(GLSLProgram program, boolean visible)
program
. Equivalent of: createControls(program, visible, true, true);
program
- a GLSL programvisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewcreateControls(GLSLProgram, boolean, boolean, boolean)
public void createControls(GLSLProgram program, boolean visible, boolean trackEvents)
program
. Equivalent of: createControls(program, visible, trackEvents, true);
program
- a GLSL programvisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupscreateControls(GLSLProgram, boolean, boolean, boolean)
public void createControls(GLSLProgram program, boolean visible, boolean trackEvents, boolean emitEvents)
program
.program
- a GLSL programvisible
- if true the Uniform Control widgets will be visible in the Uniform Controls ViewtrackEvents
- if true the Uniform Control variables (UCs) will be synchronized with other UCs with
the same names and groupsemitEvents
- if true the Uniform Control variables (UCs) will emit a synchronization events,
which can be captured by other UCs with the same names and groups to force their synchronizationpublic void removeControls(JSFragxRenderer fragxRenderer)
fragxRenderer
.fragxRenderer
- a .fragx/.stoy
rendererpublic void removeControls(GLSLProgram program)
program
.program
- a GLSL programpublic void removeAllControls()
public void refreshControls()
public boolean loadPreset(String presetName)
presetName
- the preset's namepublic int getViewportWidth()
renderable.resize()
function
(see setRenderable()
).getTrueViewportWidth()
.
Synthclipse.getViewportWidth();
Synthclipse.viewportWidth;
getTrueViewportWidth()
public int getViewportHeight()
renderable.resize()
function
(see setRenderable()
).getTrueViewportHeight()
.
Synthclipse.getViewportHeight();
Synthclipse.viewportHeight;
getTrueViewportHeight()
public int getTrueViewportWidth()
renderable.resize()
function
(see setRenderable()
), when "Buffer size/Same as Viewport"
Check Box is unselected in the Rendering View.
Synthclipse.getTrueViewportWidth();
Synthclipse.trueViewportWidth;
getViewportWidth()
public int getTrueViewportHeight()
renderable.resize()
function
(see setRenderable()
), when "Buffer size/Same as Viewport"
Check Box is unselected in the Rendering View.
Synthclipse.getTrueViewportHeight();
Synthclipse.trueViewportHeight;
getViewportHeight()
public boolean isRecording()
true
- Synthclipse is recording current script, false
- otherwise.public IRecordingInfo getRecordingInfo()
public boolean isAnimationPlaying()
true
- animation is being played, false
- otherwise.public boolean isAnimationPaused()
true
- animation is paused, false
- otherwise.public boolean isAnimationStopped()
true
- animation is stopped, false
- otherwise.