ScriptingSpark
Description
This Scripting Spark is useful for any developer who has Javascript knowledge but is not familiar with C + + language, which is the language being used to develop the sparks.
Use
The spark will provide the following interfaces:
| Asking Interfaces | Answering Interfaces |
|---|---|
|
|
In order to provide a function you need to implement it in the Javascript file
You can use the following required functions. In this functions the first param is always the component.
- IAnimation
playAnimationRequired (component, animationFileName), where animationFileName is the name of file.
- IApplication
runRequired(component)
- IAsyncFatalError
handleErrorRequired(component, msg), where msg is the error message to show.
- IAudioQueue
getStoredAudioSizeRequired(component)
dequeueAudioBufferRequired(component,buffer,size), where buffer is the content in the buffer and size is its size .
- ICamera
setCameraPositionRequired(component,x,y,z) , where the values x, y, z are float.
setCameraRotationRequired(component,x,y,z) , where the values x, y, z are float.
setCameraParametersRequired(component, IsOrtho, VisionAngle, nearClippingPlane, FarClippingPlane) , whre IsOrtho is a boolean variable and the rest are float.
- IConcurrent
startRequired(component)
stopRequired(component)
- IControlVoice
startSpeakingRequired(component)
stopSpeakingRequired(component)
startVoiceRequired(component)
- IDetectedFacePosition
consumeDetectedFacePositionRequired(component, isFaceDetected,x,y) , where the variable isFaceDetected is boolean and the rest are float.
- IEyes
rotateEyeRequired(component, pan, tilt), where the variables are float.
- IFaceExpression
setFaceExpressionRequired(component, expressionName, intensity), where expressionName is the expression name and intensity is float.
- INeck
rotateHeadRequired(component,pan,tilt), where the variables are float.
- IRenderizable
renderRequired(component)
getCamaraNodeRequired(component)
- IThreadProc
processRequired(component)
- IVoice
sayThisRequired(component, prompt), where the prompt is the string.
waitEndOfSpeechRequired(component)
stopSpeechRequired(component)
- IWindow
getWindowDisplayRequired(component)
showRequired(component)
hideRequired(component)
getColorDepthRequired(component)
makeCurrentopenGlThreadRequired(component)
openGlSwapBuffersRequired(component)
Besides all these there is also a function Log(component, msg) ,which shows the message in the debug mode.
Example
This example positions the camera in the right place using the functions provided by the interface ICamera.
function Initialize() {
log(component,"JS SIDE ====> calling log ..");
setCameraRotationRequired(component,0,0,0);
setCameraParametersRequired(component,false,45, 80,1000);
setCameraPositionRequired(component,0.63,150,90);
}
Initialize();