- for (var i = 0; i < Elements.TRIGGERS.length; i++) {
- if (Elements.TRIGGERS[i].name === name) {
- return Elements._TRIGGERS[i];
- }
- }
- for (var i = 0; i < Elements.ACTIONS.length; i++) {
- if (Elements.ACTIONS[i].name === name) {
- return Elements._ACTIONS[i];
- }
- }
- for (var i = 0; i < Elements.FLOW_CONTROLS.length; i++) {
- if (Elements.FLOW_CONTROLS[i].name === name) {
- return Elements._FLOW_CONTROLS[i];
- }
- }
- return null;
- };
- Elements._TRIGGERS = new Array();
- Elements._ACTIONS = new Array();
- Elements._FLOW_CONTROLS = new Array();
- return Elements;
- })();
- ActionsBuilder.Elements = Elements;
- // Configure triggers
- Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnLeftPickTrigger", text: "left pick", properties: [], description: "When the user picks the edited mesh using the left click" });
- Elements.TRIGGERS.push({ name: "OnRightPickTrigger", text: "right pick", properties: [], description: "When the user picks the edited mesh using the right click" });
- Elements.TRIGGERS.push({ name: "OnCenterPickTrigger", text: "center pick", properties: [], description: "When the user picks the edited mesh using the click of the mouse wheel" });
- Elements.TRIGGERS.push({ name: "OnPointerOverTrigger", text: "pointer over", properties: [], description: "When the user's mouse is over the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnPointerOutTrigger", text: "pointer out", properties: [], description: "When the user's mouse is out of the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
- Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
- Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
- Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
- Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
- // Configure actions
- Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
- Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
- Elements.ACTIONS.push({ name: "SetValueAction", text: "set value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Sets a new value to the specified parameter of the target object (example: position.x to 0.0)" });
- Elements.ACTIONS.push({ name: "SetParentAction", text: "set parent", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "parent", value: "" }], description: "Sets the new parent of the target object (example: a mesh or a light)" });
- Elements.ACTIONS.push({ name: "IncrementValueAction", text: "increment value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Increments the value of the given parameter of the target object. The value can be negative. (example: increment position.x of 5.0)" });
- Elements.ACTIONS.push({ name: "PlayAnimationAction", text: "play animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "from", value: "0" }, { text: "to", value: "150" }, { text: "loop", value: "false" }], description: "Plays an animation of the target object. Specify the start frame, the end frame and if the animation should loop." });
- Elements.ACTIONS.push({ name: "StopAnimationAction", text: "stop animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }], description: "Stops the animations of the target object." });
- Elements.ACTIONS.push({ name: "DoNothingAction", text: "do nothing", properties: [], description: "Does nothing, can be used to balance/equilibrate the actions graph." });
- Elements.ACTIONS.push({ name: "InterpolateValueAction", text: "interpolate value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "0" }, { text: "duration", value: "1000" }, { text: "stopOtherAnimations", value: "false" }], description: "Creates an animation (key frames) that animates the target object by interpolating the given parameter of the target value." });
- Elements.ACTIONS.push({ name: "CombineAction", text: "combine", properties: [], description: "Special action that combines multiple actions. The combined actions are executed at the same time. Drag'n'drop the new actions inside to combine actions." });
- // Configure flow control
- Elements.FLOW_CONTROLS.push({ name: "ValueCondition", text: "value condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }, { text: "operator", value: SceneElements.OPERATORS[0] }], description: "A condition checking if a given value is equal, different, lesser or greater than the given parameter of the target object" });
- Elements.FLOW_CONTROLS.push({ name: "StateCondition", text: "state condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "A condition checking if the target object's state is equal to the given state. See \"set state\" action to set a state to an object." });
- Elements.FLOW_CONTROLS.push({ name: "Hub", text: "hub", properties: [], description: "The hub is internally used by the Combine Action. It allows to add children to the Combine Action" });
+ for (var i = 0; i < Elements.TRIGGERS.length; i++) {
+ if (Elements.TRIGGERS[i].name === name) {
+ return Elements._TRIGGERS[i];
+ }
+ }
+ for (var i = 0; i < Elements.ACTIONS.length; i++) {
+ if (Elements.ACTIONS[i].name === name) {
+ return Elements._ACTIONS[i];
+ }
+ }
+ for (var i = 0; i < Elements.FLOW_CONTROLS.length; i++) {
+ if (Elements.FLOW_CONTROLS[i].name === name) {
+ return Elements._FLOW_CONTROLS[i];
+ }
+ }
+ return null;
+ };
+ return Elements;
+ }());
+ Elements._TRIGGERS = new Array();
+ Elements._ACTIONS = new Array();
+ Elements._FLOW_CONTROLS = new Array();
+ ActionsBuilder.Elements = Elements;
+ // Configure triggers
+ Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnLeftPickTrigger", text: "left pick", properties: [], description: "When the user picks the edited mesh using the left click" });
+ Elements.TRIGGERS.push({ name: "OnRightPickTrigger", text: "right pick", properties: [], description: "When the user picks the edited mesh using the right click" });
+ Elements.TRIGGERS.push({ name: "OnCenterPickTrigger", text: "center pick", properties: [], description: "When the user picks the edited mesh using the click of the mouse wheel" });
+ Elements.TRIGGERS.push({ name: "OnPointerOverTrigger", text: "pointer over", properties: [], description: "When the user's mouse is over the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnPointerOutTrigger", text: "pointer out", properties: [], description: "When the user's mouse is out of the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
+ Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
+ // Configure actions
+ Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
+ Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
+ Elements.ACTIONS.push({ name: "SetValueAction", text: "set value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Sets a new value to the specified parameter of the target object (example: position.x to 0.0)" });
+ Elements.ACTIONS.push({ name: "SetParentAction", text: "set parent", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "parent", value: "" }], description: "Sets the new parent of the target object (example: a mesh or a light)" });
+ Elements.ACTIONS.push({ name: "IncrementValueAction", text: "increment value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Increments the value of the given parameter of the target object. The value can be negative. (example: increment position.x of 5.0)" });
+ Elements.ACTIONS.push({ name: "PlayAnimationAction", text: "play animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "from", value: "0" }, { text: "to", value: "150" }, { text: "loop", value: "false" }], description: "Plays an animation of the target object. Specify the start frame, the end frame and if the animation should loop." });
+ Elements.ACTIONS.push({ name: "StopAnimationAction", text: "stop animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }], description: "Stops the animations of the target object." });
+ Elements.ACTIONS.push({ name: "DoNothingAction", text: "do nothing", properties: [], description: "Does nothing, can be used to balance/equilibrate the actions graph." });
+ Elements.ACTIONS.push({ name: "InterpolateValueAction", text: "interpolate value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "0" }, { text: "duration", value: "1000" }, { text: "stopOtherAnimations", value: "false" }], description: "Creates an animation (key frames) that animates the target object by interpolating the given parameter of the target value." });
+ Elements.ACTIONS.push({ name: "CombineAction", text: "combine", properties: [], description: "Special action that combines multiple actions. The combined actions are executed at the same time. Drag'n'drop the new actions inside to combine actions." });
+ // Configure flow control
+ Elements.FLOW_CONTROLS.push({ name: "ValueCondition", text: "value condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }, { text: "operator", value: SceneElements.OPERATORS[0] }], description: "A condition checking if a given value is equal, different, lesser or greater than the given parameter of the target object" });
+ Elements.FLOW_CONTROLS.push({ name: "StateCondition", text: "state condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "A condition checking if the target object's state is equal to the given state. See \"set state\" action to set a state to an object." });
+ Elements.FLOW_CONTROLS.push({ name: "Hub", text: "hub", properties: [], description: "The hub is internally used by the Combine Action. It allows to add children to the Combine Action" });
- SceneElements._ENGINE = new BABYLON.Engine(document.getElementById("RenderCanvasID"));
- SceneElements._SCENE = new BABYLON.Scene(SceneElements.ENGINE);
- SceneElements._MESH = new BABYLON.Mesh("mesh", SceneElements._SCENE);
- SceneElements._LIGHT = new BABYLON.Light("light", SceneElements._SCENE);
- SceneElements._CAMERA = new BABYLON.Camera("camera", BABYLON.Vector3.Zero(), SceneElements._SCENE);
- /*
- * Objects names
- */
- SceneElements._MESHES = new Array();
- SceneElements._LIGHTS = new Array();
- SceneElements._CAMERAS = new Array();
- SceneElements._SOUNDS = new Array();
- /*
- * Properties
- */
- SceneElements._MESH_PROPERTIES = new Array();
- SceneElements._LIGHT_PROPERTIES = new Array();
- SceneElements._CAMERA_PROPERTIES = new Array();
- SceneElements._SCENE_PROPERTIES = new Array();
- /*
- * Types
- */
- SceneElements._TYPES = new Array();
- /*
- * Operators
- */
- SceneElements._OPERATORS = new Array();
return SceneElements;
return SceneElements;
- })();
+ }());
+ /*
+ * BabylonJS objects
+ */
+ SceneElements._ENGINE = new BABYLON.Engine(document.getElementById("RenderCanvasID"));
+ SceneElements._SCENE = new BABYLON.Scene(SceneElements.ENGINE);
+ SceneElements._MESH = new BABYLON.Mesh("mesh", SceneElements._SCENE);
+ SceneElements._LIGHT = new BABYLON.Light("light", SceneElements._SCENE);
+ SceneElements._CAMERA = new BABYLON.Camera("camera", BABYLON.Vector3.Zero(), SceneElements._SCENE);
+ /*
+ * Objects names
+ */
+ SceneElements._MESHES = new Array();
+ SceneElements._LIGHTS = new Array();
+ SceneElements._CAMERAS = new Array();
+ SceneElements._SOUNDS = new Array();
+ /*
+ * Properties
+ */
+ SceneElements._MESH_PROPERTIES = new Array();
+ SceneElements._LIGHT_PROPERTIES = new Array();
+ SceneElements._CAMERA_PROPERTIES = new Array();
+ SceneElements._SCENE_PROPERTIES = new Array();
+ /*
+ * Types
+ */
+ SceneElements._TYPES = new Array();
+ /*
+ * Operators
+ */
+ SceneElements._OPERATORS = new Array();
ActionsBuilder.SceneElements = SceneElements;
ActionsBuilder.SceneElements = SceneElements;
// Functions
// Functions
var specialTypes = [
var specialTypes = [
@@ -1508,11 +1525,11 @@ var ActionsBuilder;
}
}
return null;
return null;
};
};
- Elements._TRIGGERS = new Array();
- Elements._ACTIONS = new Array();
- Elements._FLOW_CONTROLS = new Array();
return Elements;
return Elements;
- })();
+ }());
+ Elements._TRIGGERS = new Array();
+ Elements._ACTIONS = new Array();
+ Elements._FLOW_CONTROLS = new Array();
ActionsBuilder.Elements = Elements;
ActionsBuilder.Elements = Elements;
// Configure triggers
// Configure triggers
Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
@@ -1524,8 +1541,8 @@ var ActionsBuilder;
Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
- Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
- Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
+ Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
+ Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
// Configure actions
// Configure actions
Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
-SINKIN SANS is a simple, pleasantly proportioned sans serif with tiny, inconspicuous notches that sink into verticals at the intersections of strokes adding highlights to congested corners. The incisions make right angles appear sharper and improve definition in more intricate glyphs. Although the nicks are barely noticeable they add emphasis to outlines and give a lift to shady nooks.
-
-------------------------------------------------
-
-== Licence Information ==
-
-All weights of SINKIN SANS are totally free for commercial and personal use as desktop and web fonts. For @font-face users, a link to www.k-type.com somewhere on your site is requested, elsewhere a credit to K-Type is appreciated.
-
-You can freely distribute and modify SINKIN SANS provided the original copyright, license information and details of any modifications are included. SINKIN SANS is gifted 'as is', without warranty. SINKIN SANS is a trademark of K-Type. Licensed under the Apache License, Version 2.0
-
-http://www.apache.org/licenses/LICENSE-2.0.html
-
-------------------------------------------------
-
-== Installing Fonts ==
-
-Fonts are placed in your operating system's Fonts folder and will be made available to all the applications or programs you use.
-
-= Windows =
-Put the .ttf or .otf font file into C:\Windows\Fonts, or right-click on the font files > Install
-
-= Mac =
-Put the .ttf or .otf font file into /Library/Fonts
+ for (var i = 0; i < Elements.TRIGGERS.length; i++) {
+ if (Elements.TRIGGERS[i].name === name) {
+ return Elements._TRIGGERS[i];
+ }
+ }
+ for (var i = 0; i < Elements.ACTIONS.length; i++) {
+ if (Elements.ACTIONS[i].name === name) {
+ return Elements._ACTIONS[i];
+ }
+ }
+ for (var i = 0; i < Elements.FLOW_CONTROLS.length; i++) {
+ if (Elements.FLOW_CONTROLS[i].name === name) {
+ return Elements._FLOW_CONTROLS[i];
+ }
+ }
+ return null;
+ };
+ Elements._TRIGGERS = new Array();
+ Elements._ACTIONS = new Array();
+ Elements._FLOW_CONTROLS = new Array();
+ return Elements;
+ })();
+ ActionsBuilder.Elements = Elements;
+ Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnLeftPickTrigger", text: "left pick", properties: [], description: "When the user picks the edited mesh using the left click" });
+ Elements.TRIGGERS.push({ name: "OnRightPickTrigger", text: "right pick", properties: [], description: "When the user picks the edited mesh using the right click" });
+ Elements.TRIGGERS.push({ name: "OnCenterPickTrigger", text: "center pick", properties: [], description: "When the user picks the edited mesh using the click of the mouse wheel" });
+ Elements.TRIGGERS.push({ name: "OnPointerOverTrigger", text: "pointer over", properties: [], description: "When the user's mouse is over the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnPointerOutTrigger", text: "pointer out", properties: [], description: "When the user's mouse is out of the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
+ Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
+ Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
+ Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
+ Elements.ACTIONS.push({ name: "SetValueAction", text: "set value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Sets a new value to the specified parameter of the target object (example: position.x to 0.0)" });
+ Elements.ACTIONS.push({ name: "SetParentAction", text: "set parent", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "parent", value: "" }], description: "Sets the new parent of the target object (example: a mesh or a light)" });
+ Elements.ACTIONS.push({ name: "IncrementValueAction", text: "increment value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Increments the value of the given parameter of the target object. The value can be negative. (example: increment position.x of 5.0)" });
+ Elements.ACTIONS.push({ name: "PlayAnimationAction", text: "play animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "from", value: "0" }, { text: "to", value: "150" }, { text: "loop", value: "false" }], description: "Plays an animation of the target object. Specify the start frame, the end frame and if the animation should loop." });
+ Elements.ACTIONS.push({ name: "StopAnimationAction", text: "stop animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }], description: "Stops the animations of the target object." });
+ Elements.ACTIONS.push({ name: "DoNothingAction", text: "do nothing", properties: [], description: "Does nothing, can be used to balance/equilibrate the actions graph." });
+ Elements.ACTIONS.push({ name: "InterpolateValueAction", text: "interpolate value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "0" }, { text: "duration", value: "1000" }, { text: "stopOtherAnimations", value: "false" }], description: "Creates an animation (key frames) that animates the target object by interpolating the given parameter of the target value." });
+ Elements.ACTIONS.push({ name: "CombineAction", text: "combine", properties: [], description: "Special action that combines multiple actions. The combined actions are executed at the same time. Drag'n'drop the new actions inside to combine actions." });
+ Elements.FLOW_CONTROLS.push({ name: "ValueCondition", text: "value condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }, { text: "operator", value: SceneElements.OPERATORS[0] }], description: "A condition checking if a given value is equal, different, lesser or greater than the given parameter of the target object" });
+ Elements.FLOW_CONTROLS.push({ name: "StateCondition", text: "state condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "A condition checking if the target object's state is equal to the given state. See \"set state\" action to set a state to an object." });
+ Elements.FLOW_CONTROLS.push({ name: "Hub", text: "hub", properties: [], description: "The hub is internally used by the Combine Action. It allows to add children to the Combine Action" });
- else if (SceneElements.TestInstanceOf(SceneElements.MESH[thing], thing)) {
- SceneElements.MESH_PROPERTIES.push(thing);
- }
- }
- }
-
- for (var thing in SceneElements.LIGHT) {
- if (SceneElements.LIGHT.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.LIGHT[thing], thing)) {
- SceneElements.LIGHT_PROPERTIES.push(thing);
- }
- }
-
- for (var thing in SceneElements.CAMERA) {
- if (SceneElements.CAMERA.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.CAMERA[thing], thing)) {
- SceneElements.CAMERA_PROPERTIES.push(thing);
- }
- }
-
- for (var thing in SceneElements.SCENE) {
- if (SceneElements.SCENE.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.SCENE[thing], thing)) {
- SceneElements.SCENE_PROPERTIES.push(thing);
- }
- }
-
- /**
- * Defines an element property
- */
- export interface ElementProperty {
- targetType?: string;
- text: string;
- value: string;
- }
-
- /**
- * Defines an element property result
- */
- export interface ElementPropertyResult {
- targetType?: string;
- value: string;
- }
-
- /**
- * Generic element, has a name, a text to draw, a description
- * and a list of properties (ElementProperty)
- */
- export interface Element {
- name: string;
- text: string;
- properties: Array<ElementProperty>;
- description: string;
- }
-
- /**
- * Actions Builder elements (triggers, actions & flow controls) that are
- * arrays of Element
- */
- export class Elements {
- private static _TRIGGERS = new Array<Element>();
- private static _ACTIONS = new Array<Element>();
- private static _FLOW_CONTROLS = new Array<Element>();
-
- public static get TRIGGERS(): Array<Element> {
- return Elements._TRIGGERS;
- }
-
- public static get ACTIONS(): Array<Element> {
- return Elements._ACTIONS;
- }
-
- public static get FLOW_CONTROLS(): Array<Element> {
- return Elements._FLOW_CONTROLS;
- }
-
- public static GetElementFromName(name: string): Element {
- for (var i = 0; i < Elements.TRIGGERS.length; i++) {
- if (Elements.TRIGGERS[i].name === name) {
- return Elements._TRIGGERS[i];
- }
- }
-
- for (var i = 0; i < Elements.ACTIONS.length; i++) {
- if (Elements.ACTIONS[i].name === name) {
- return Elements._ACTIONS[i];
- }
- }
-
- for (var i = 0; i < Elements.FLOW_CONTROLS.length; i++) {
- if (Elements.FLOW_CONTROLS[i].name === name) {
- return Elements._FLOW_CONTROLS[i];
- }
- }
-
- return null;
- }
- }
-
- // Configure triggers
- Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnLeftPickTrigger", text: "left pick", properties: [], description: "When the user picks the edited mesh using the left click" });
- Elements.TRIGGERS.push({ name: "OnRightPickTrigger", text: "right pick", properties: [], description: "When the user picks the edited mesh using the right click" });
- Elements.TRIGGERS.push({ name: "OnCenterPickTrigger", text: "center pick", properties: [], description: "When the user picks the edited mesh using the click of the mouse wheel" });
- Elements.TRIGGERS.push({ name: "OnPointerOverTrigger", text: "pointer over", properties: [], description: "When the user's mouse is over the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnPointerOutTrigger", text: "pointer out", properties: [], description: "When the user's mouse is out of the edited mesh" });
- Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
- Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
- Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
- Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
- Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter:", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
-
- // Configure actions
- Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
- Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
- Elements.ACTIONS.push({ name: "SetValueAction", text: "set value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Sets a new value to the specified parameter of the target object (example: position.x to 0.0)" });
- Elements.ACTIONS.push({ name: "SetParentAction", text: "set parent", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "parent", value: "" }], description: "Sets the new parent of the target object (example: a mesh or a light)" });
- Elements.ACTIONS.push({ name: "IncrementValueAction", text: "increment value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Increments the value of the given parameter of the target object. The value can be negative. (example: increment position.x of 5.0)" });
- Elements.ACTIONS.push({ name: "PlayAnimationAction", text: "play animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "from", value: "0" }, { text: "to", value: "150" }, { text: "loop", value: "false" }], description: "Plays an animation of the target object. Specify the start frame, the end frame and if the animation should loop." });
- Elements.ACTIONS.push({ name: "StopAnimationAction", text: "stop animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }], description: "Stops the animations of the target object." });
- Elements.ACTIONS.push({ name: "DoNothingAction", text: "do nothing", properties: [], description: "Does nothing, can be used to balance/equilibrate the actions graph." });
- Elements.ACTIONS.push({ name: "InterpolateValueAction", text: "interpolate value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "0" }, { text: "duration", value: "1000" }, { text: "stopOtherAnimations", value: "false" }], description: "Creates an animation (key frames) that animates the target object by interpolating the given parameter of the target value." });
- Elements.ACTIONS.push({ name: "CombineAction", text: "combine", properties: [], description: "Special action that combines multiple actions. The combined actions are executed at the same time. Drag'n'drop the new actions inside to combine actions." });
-
- // Configure flow control
- Elements.FLOW_CONTROLS.push({ name: "ValueCondition", text: "value condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }, { text: "operator", value: SceneElements.OPERATORS[0] }], description: "A condition checking if a given value is equal, different, lesser or greater than the given parameter of the target object" });
- Elements.FLOW_CONTROLS.push({ name: "StateCondition", text: "state condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "A condition checking if the target object's state is equal to the given state. See \"set state\" action to set a state to an object." });
- Elements.FLOW_CONTROLS.push({ name: "Hub", text: "hub", properties: [], description: "The hub is internally used by the Combine Action. It allows to add children to the Combine Action" });
-}
+module ActionsBuilder {
+
+ /**
+ * Defines static types
+ */
+ export class Type {
+ private static _TRIGGER = 0;
+ private static _ACTION = 1;
+ private static _FLOW_CONTROL = 2;
+ private static _OBJECT = 3;
+ private static _SCENE = 4;
+
+ public static get TRIGGER(): number {
+ return Type._TRIGGER;
+ }
+
+ public static get ACTION(): number {
+ return Type._ACTION;
+ }
+
+ public static get FLOW_CONTROL(): number {
+ return Type._FLOW_CONTROL;
+ }
+
+ public static get OBJECT(): number {
+ return Type._OBJECT;
+ }
+
+ public static get SCENE(): number {
+ return Type._SCENE;
+ }
+ }
+
+ /*
+ * Defines the BABYLON.JS elements
+ */
+ export class SceneElements {
+ /*
+ * BabylonJS objects
+ */
+ private static _ENGINE: BABYLON.Engine = new BABYLON.Engine(<HTMLCanvasElement>document.getElementById("RenderCanvasID"));
+ private static _SCENE: BABYLON.Scene = new BABYLON.Scene(SceneElements.ENGINE);
+ private static _MESH: BABYLON.Mesh = new BABYLON.Mesh("mesh", SceneElements._SCENE);
+ private static _LIGHT: BABYLON.Light = new BABYLON.Light("light", SceneElements._SCENE);
+ private static _CAMERA: BABYLON.Camera = new BABYLON.Camera("camera", BABYLON.Vector3.Zero(), SceneElements._SCENE);
+
+ public static get ENGINE(): BABYLON.Engine {
+ return SceneElements._ENGINE;
+ }
+
+ public static get SCENE(): BABYLON.Scene {
+ return SceneElements._SCENE;
+ }
+
+ public static get MESH(): BABYLON.Mesh {
+ return SceneElements._MESH;
+ }
+
+ public static get LIGHT(): BABYLON.Light {
+ return SceneElements._LIGHT;
+ }
+
+ public static get CAMERA(): BABYLON.Camera {
+ return SceneElements._CAMERA;
+ }
+
+ /*
+ * Objects names
+ */
+ private static _MESHES = new Array<string>();
+ private static _LIGHTS = new Array<string>();
+ private static _CAMERAS = new Array<string>();
+ private static _SOUNDS = new Array<string>();
+
+ public static get MESHES(): Array<string> {
+ return SceneElements._MESHES;
+ }
+
+ public static get LIGHTS(): Array<string> {
+ return SceneElements._LIGHTS;
+ }
+
+ public static get CAMERAS(): Array<string> {
+ return SceneElements._CAMERAS;
+ }
+
+ public static get SOUNDS(): Array<string> {
+ return SceneElements._SOUNDS;
+ }
+
+ /*
+ * Properties
+ */
+ private static _MESH_PROPERTIES = new Array<string>();
+ private static _LIGHT_PROPERTIES = new Array<string>();
+ private static _CAMERA_PROPERTIES = new Array<string>();
+ private static _SCENE_PROPERTIES = new Array<string>();
+
+ public static get MESH_PROPERTIES(): Array<string> {
+ return SceneElements._MESH_PROPERTIES;
+ }
+
+ public static get LIGHT_PROPERTIES(): Array<string> {
+ return SceneElements._LIGHT_PROPERTIES;
+ }
+
+ public static get CAMERA_PROPERTIES(): Array<string> {
+ return SceneElements._CAMERA_PROPERTIES;
+ }
+
+ public static get SCENE_PROPERTIES(): Array<string> {
+ return SceneElements._SCENE_PROPERTIES;
+ }
+
+ /*
+ * Types
+ */
+ private static _TYPES = new Array<string>();
+
+ public static get TYPES(): Array<string> {
+ return SceneElements._TYPES;
+ }
+
+ /*
+ * Operators
+ */
+ private static _OPERATORS = new Array<string>();
+
+ public static get OPERATORS(): Array<string> {
+ return SceneElements._OPERATORS;
+ }
+
+ /*
+ * Methods
+ */
+ public static GetInstanceOf(object: Object): string {
+ else if (SceneElements.TestInstanceOf(SceneElements.MESH[thing], thing)) {
+ SceneElements.MESH_PROPERTIES.push(thing);
+ }
+ }
+ }
+
+ for (var thing in SceneElements.LIGHT) {
+ if (SceneElements.LIGHT.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.LIGHT[thing], thing)) {
+ SceneElements.LIGHT_PROPERTIES.push(thing);
+ }
+ }
+
+ for (var thing in SceneElements.CAMERA) {
+ if (SceneElements.CAMERA.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.CAMERA[thing], thing)) {
+ SceneElements.CAMERA_PROPERTIES.push(thing);
+ }
+ }
+
+ for (var thing in SceneElements.SCENE) {
+ if (SceneElements.SCENE.hasOwnProperty(thing) && SceneElements.TestInstanceOf(SceneElements.SCENE[thing], thing)) {
+ SceneElements.SCENE_PROPERTIES.push(thing);
+ }
+ }
+
+ /**
+ * Defines an element property
+ */
+ export interface ElementProperty {
+ targetType?: string;
+ text: string;
+ value: string;
+ }
+
+ /**
+ * Defines an element property result
+ */
+ export interface ElementPropertyResult {
+ targetType?: string;
+ value: string;
+ }
+
+ /**
+ * Generic element, has a name, a text to draw, a description
+ * and a list of properties (ElementProperty)
+ */
+ export interface Element {
+ name: string;
+ text: string;
+ properties: Array<ElementProperty>;
+ description: string;
+ }
+
+ /**
+ * Actions Builder elements (triggers, actions & flow controls) that are
+ * arrays of Element
+ */
+ export class Elements {
+ private static _TRIGGERS = new Array<Element>();
+ private static _ACTIONS = new Array<Element>();
+ private static _FLOW_CONTROLS = new Array<Element>();
+
+ public static get TRIGGERS(): Array<Element> {
+ return Elements._TRIGGERS;
+ }
+
+ public static get ACTIONS(): Array<Element> {
+ return Elements._ACTIONS;
+ }
+
+ public static get FLOW_CONTROLS(): Array<Element> {
+ return Elements._FLOW_CONTROLS;
+ }
+
+ public static GetElementFromName(name: string): Element {
+ for (var i = 0; i < Elements.TRIGGERS.length; i++) {
+ if (Elements.TRIGGERS[i].name === name) {
+ return Elements._TRIGGERS[i];
+ }
+ }
+
+ for (var i = 0; i < Elements.ACTIONS.length; i++) {
+ if (Elements.ACTIONS[i].name === name) {
+ return Elements._ACTIONS[i];
+ }
+ }
+
+ for (var i = 0; i < Elements.FLOW_CONTROLS.length; i++) {
+ if (Elements.FLOW_CONTROLS[i].name === name) {
+ return Elements._FLOW_CONTROLS[i];
+ }
+ }
+
+ return null;
+ }
+ }
+
+ // Configure triggers
+ Elements.TRIGGERS.push({ name: "OnPickTrigger", text: "pick", properties: [], description: "When the user picks the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnLeftPickTrigger", text: "left pick", properties: [], description: "When the user picks the edited mesh using the left click" });
+ Elements.TRIGGERS.push({ name: "OnRightPickTrigger", text: "right pick", properties: [], description: "When the user picks the edited mesh using the right click" });
+ Elements.TRIGGERS.push({ name: "OnCenterPickTrigger", text: "center pick", properties: [], description: "When the user picks the edited mesh using the click of the mouse wheel" });
+ Elements.TRIGGERS.push({ name: "OnPointerOverTrigger", text: "pointer over", properties: [], description: "When the user's mouse is over the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnPointerOutTrigger", text: "pointer out", properties: [], description: "When the user's mouse is out of the edited mesh" });
+ Elements.TRIGGERS.push({ name: "OnEveryFrameTrigger", text: "every frame", properties: [], description: "This trigger is called each frame (only on scene)" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionEnterTrigger", text: "intersection enter", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh intersects the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnIntersectionExitTrigger", text: "intersection exit", properties: [{ targetType: "MeshProperties", text: "parameter", value: "Object name?" }], description: "When the edited mesh exits intersection with the another mesh predefined in the options" });
+ Elements.TRIGGERS.push({ name: "OnKeyDownTrigger", text: "key down", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user pressed a key (enter the key character, example: \"r\")" });
+ Elements.TRIGGERS.push({ name: "OnKeyUpTrigger", text: "key up", properties: [{ targetType: null, text: "parameter", value: "a" }], description: "When the user unpressed a key (enter the key character, example: \"p\")" });
+
+ // Configure actions
+ Elements.ACTIONS.push({ name: "SwitchBooleanAction", text: "switch boolean", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }], description: "Switches the boolean value of a given parameter of the target object: true to false, or false to true" });
+ Elements.ACTIONS.push({ name: "SetStateAction", text: "set state", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "Sets a new state value for the target object (example: \"off\" or \"on\")" });
+ Elements.ACTIONS.push({ name: "SetValueAction", text: "set value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Sets a new value to the specified parameter of the target object (example: position.x to 0.0)" });
+ Elements.ACTIONS.push({ name: "SetParentAction", text: "set parent", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "parent", value: "" }], description: "Sets the new parent of the target object (example: a mesh or a light)" });
+ Elements.ACTIONS.push({ name: "IncrementValueAction", text: "increment value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }], description: "Increments the value of the given parameter of the target object. The value can be negative. (example: increment position.x of 5.0)" });
+ Elements.ACTIONS.push({ name: "PlayAnimationAction", text: "play animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "from", value: "0" }, { text: "to", value: "150" }, { text: "loop", value: "false" }], description: "Plays an animation of the target object. Specify the start frame, the end frame and if the animation should loop." });
+ Elements.ACTIONS.push({ name: "StopAnimationAction", text: "stop animation", properties: [{ targetType: "MeshProperties", text: "target", value: "" }], description: "Stops the animations of the target object." });
+ Elements.ACTIONS.push({ name: "DoNothingAction", text: "do nothing", properties: [], description: "Does nothing, can be used to balance/equilibrate the actions graph." });
+ Elements.ACTIONS.push({ name: "InterpolateValueAction", text: "interpolate value", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "0" }, { text: "duration", value: "1000" }, { text: "stopOtherAnimations", value: "false" }], description: "Creates an animation (key frames) that animates the target object by interpolating the given parameter of the target value." });
+ Elements.ACTIONS.push({ name: "CombineAction", text: "combine", properties: [], description: "Special action that combines multiple actions. The combined actions are executed at the same time. Drag'n'drop the new actions inside to combine actions." });
+
+ // Configure flow control
+ Elements.FLOW_CONTROLS.push({ name: "ValueCondition", text: "value condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "propertyPath", value: "" }, { text: "value", value: "" }, { text: "operator", value: SceneElements.OPERATORS[0] }], description: "A condition checking if a given value is equal, different, lesser or greater than the given parameter of the target object" });
+ Elements.FLOW_CONTROLS.push({ name: "StateCondition", text: "state condition", properties: [{ targetType: "MeshProperties", text: "target", value: "" }, { text: "value", value: "" }], description: "A condition checking if the target object's state is equal to the given state. See \"set state\" action to set a state to an object." });
+ Elements.FLOW_CONTROLS.push({ name: "Hub", text: "hub", properties: [], description: "The hub is internally used by the Combine Action. It allows to add children to the Combine Action" });
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
- <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
- <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ // If the stack panel is horizontal we check if the primitive height is auto or not, if it's auto then we have to compute the required height, otherwise we just take the actualHeight. If the stack panel is vertical we do the same but with width
let max = 0;
let max = 0;
+ let stackPanelLayoutArea = StackPanelLayoutEngine.stackPanelLayoutArea;
// Create a canvas for the signed distance field mode, we only have to store one char, the purpose is to render a char scaled _sdfScale times
// Create a canvas for the signed distance field mode, we only have to store one char, the purpose is to render a char scaled _sdfScale times
- // into this 2D context, then get the bitmap data, create the sdf char and push the result in the _context (which hold the whole Font Texture content)
+ // into this 2D context, then get the bitmap data, create the SDF char and push the result in the _context (which hold the whole Font Texture content)
// So you can see this context as an intermediate one, because it is.
// So you can see this context as an intermediate one, because it is.
if (this._currentFreePosition.y > textureSize.height) {
if (this._currentFreePosition.y > textureSize.height) {
@@ -508,22 +556,68 @@
}
}
}
}
- // In sdf mode we render the character in an intermediate 2D context which scale the character this._sdfScale times (which is required to compute the sdf map accurately)
+ let curPosX = this._currentFreePosition.x + 0.5;
+ let curPosY = this._currentFreePosition.y + 0.5;
+ let curPosXMargin = curPosX + this._xMargin;
+ let curPosYMargin = curPosY + this._yMargin;
+
+ let drawDebug = (ctx: CanvasRenderingContext2D) => {
+ // In SDF mode we render the character in an intermediate 2D context which scale the character this._sdfScale times (which is required to compute the SDF map accurately)
@instanceLevelProperty(Prim2DBase.PRIM2DBASE_PROPCOUNT + 1, pi => Group2D.sizeProperty = pi, false, true)
@instanceLevelProperty(Prim2DBase.PRIM2DBASE_PROPCOUNT + 1, pi => Group2D.sizeProperty = pi, false, true)
public get size(): Size {
public get size(): Size {
- return this._size;
+ return this.internalGetSize();
}
}
/**
/**
@@ -264,49 +264,6 @@
return this._viewportSize;
return this._viewportSize;
}
}
- @instanceLevelProperty(Prim2DBase.PRIM2DBASE_PROPCOUNT + 2, pi => Group2D.actualSizeProperty = pi)
- /**
- * Get the actual size of the group, if the size property is not null, this value will be the same, but if size is null, actualSize will return the size computed from the group's bounding content.
- */
- public get actualSize(): Size {
- // The computed size will be floor on both width and height
- let actualSize: Size;
-
- // Return the actualSize if set
- if (this._actualSize) {
- return this._actualSize;
- }
-
- // Return the size if set by the user
- if (this._size) {
- actualSize = new Size(Math.ceil(this._size.width), Math.ceil(this._size.height));
- }
-
- // Otherwise the size is computed based on the boundingInfo of the layout (or bounding info) content
- else {
- let m = this.layoutBoundingInfo.max();
- actualSize = new Size(Math.ceil(m.x), Math.ceil(m.y));
- }
-
- // Compare the size with the one we previously had, if it differs we set the property dirty and trigger a GroupChanged to synchronize a displaySprite (if any)
* Get/set the Cache Behavior, used in case the Canvas Cache Strategy is set to CACHESTRATEGY_ALLGROUPS. Can be either GROUPCACHEBEHAVIOR_CACHEINPARENTGROUP, GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE or GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY. See their documentation for more information.
* Get/set the Cache Behavior, used in case the Canvas Cache Strategy is set to CACHESTRATEGY_ALLGROUPS. Can be either GROUPCACHEBEHAVIOR_CACHEINPARENTGROUP, GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE or GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY. See their documentation for more information.
* GROUPCACHEBEHAVIOR_NORESIZEONSCALE can also be set if you set it at creation time.
* GROUPCACHEBEHAVIOR_NORESIZEONSCALE can also be set if you set it at creation time.
@@ -398,8 +355,9 @@
let s = this.actualSize;
let s = this.actualSize;
let a = this.actualScale;
let a = this.actualScale;
- let sw = Math.ceil(s.width * a.x);
- let sh = Math.ceil(s.height * a.y);
+ let hwsl = 1/this.owner.engine.getHardwareScalingLevel();
+ let sw = Math.ceil(s.width * a.x * hwsl);
+ let sh = Math.ceil(s.height * a.y * hwsl);
// The dimension must be overridden when using the designSize feature, the ratio is maintain to compute a uniform scale, which is mandatory but if the designSize's ratio is different from the rendering surface's ratio, content will be clipped in some cases.
// The dimension must be overridden when using the designSize feature, the ratio is maintain to compute a uniform scale, which is mandatory but if the designSize's ratio is different from the rendering surface's ratio, content will be clipped in some cases.
// So we set the width/height to the rendering's one because that's what we want for the viewport!
// So we set the width/height to the rendering's one because that's what we want for the viewport!
@@ -413,7 +371,7 @@
if (!this._isCachedGroup) {
if (!this._isCachedGroup) {
// Compute the WebGL viewport's location/size
// Compute the WebGL viewport's location/size
let t = this._globalTransform.getTranslation();
let t = this._globalTransform.getTranslation();
- let rs = this.owner._renderingSize;
+ let rs = this.owner._renderingSize.multiplyByFloats(hwsl, hwsl);
let t = this._globalTransform.multiply(this.renderGroup.invGlobalTransform); // Compute the transformation into the renderGroup's space
let t = this._globalTransform.multiply(this.renderGroup.invGlobalTransform); // Compute the transformation into the renderGroup's space
- let rgScale = this._areSomeFlagsSet(SmartPropertyPrim.flagDontInheritParentScale) ? RenderablePrim2D._uV : this.renderGroup.actualScale; // We still need to apply the scale of the renderGroup to our rendering, so get it.
+ let scl = RenderablePrim2D._s;
+ let rot = RenderablePrim2D._r;
+ let trn = RenderablePrim2D._t;
+ t.decompose(scl, rot, trn);
+ let pas = this.actualScale;
+ scl.x = pas.x;
+ scl.y = pas.y;
+ scl.z = 1;
+ t = Matrix.Compose(this.applyActualScaleOnTransform() ? scl : RenderablePrim2D._iV3, rot, trn);
+
let size = (<Size>this.renderGroup.viewportSize);
let size = (<Size>this.renderGroup.viewportSize);
let zBias = this.actualZOffset;
let zBias = this.actualZOffset;
let offX = 0;
let offX = 0;
let offY = 0;
let offY = 0;
+
// If there's an offset, apply the global transformation matrix on it to get a global offset
// If there's an offset, apply the global transformation matrix on it to get a global offset
+ public transformFloats(x: number, y: number): Vector2 {
+ let res = Vector2.Zero();
+ this.transformFloatsToRef(x, y, res);
+ return res;
+ }
+
+ public transformFloatsToRef(x: number, y: number, r: Vector2) {
+ r.x = x * this.m[0] + y * this.m[2] + this.m[4];
+ r.y = x * this.m[1] + y * this.m[3] + this.m[5];
+ }
+
+ public transformPoint(p: Vector2): Vector2 {
+ let res = Vector2.Zero();
+ this.transformFloatsToRef(p.x, p.y, res);
+ return res;
+ }
+
+ public transformPointToRef(p: Vector2, r: Vector2) {
+ this.transformFloatsToRef(p.x, p.y, r);
+ }
+
+ public m = new Float32Array(6);
+ }
+
+ /**
+ * Stores information about a 2D Triangle.
+ * This class stores the 3 vertices but also the center and radius of the triangle
+ */
export class Tri2DInfo {
export class Tri2DInfo {
/**
/**
* Construct an instance of Tri2DInfo, you can either pass null to a, b and c and the instance will be allocated "clear", or give actual triangle info and the center/radius will be computed
* Construct an instance of Tri2DInfo, you can either pass null to a, b and c and the instance will be allocated "clear", or give actual triangle info and the center/radius will be computed
@@ -64,12 +604,22 @@
}
}
}
}
+ /**
+ * Stores an array of 2D Triangles.
+ * Internally the data is stored as a Float32Array to minimize the memory footprint.
+ * This can use the Tri2DInfo class as proxy for storing/retrieving data.
+ * The array can't grow, it's fixed size.
+ */
export class Tri2DArray {
export class Tri2DArray {
constructor(count: number) {
constructor(count: number) {
this._count = count;
this._count = count;
this._array = new Float32Array(9 * count);
this._array = new Float32Array(9 * count);
}
}
+ /**
+ * Clear the content and allocate a new array to store the given count of triangles
+ * @param count The new count of triangles to store
+ */
public clear(count: number) {
public clear(count: number) {
if (this._count === count) {
if (this._count === count) {
return;
return;
@@ -79,6 +629,13 @@
this._array = new Float32Array(9 * count);
this._array = new Float32Array(9 * count);
}
}
+ /**
+ * Store a given triangle at the given index
+ * @param index the 0 based index to store the triangle in the array
+ * @param a the A vertex of the triangle
+ * @param b the B vertex of the triangle
+ * @param c the C vertex of the triangle
+ */
public storeTriangle(index: number, a: Vector2, b: Vector2, c: Vector2) {
public storeTriangle(index: number, a: Vector2, b: Vector2, c: Vector2) {
let center = new Vector2((a.x + b.x + c.x) / 3, (a.y + b.y + c.y) / 3);
let center = new Vector2((a.x + b.x + c.x) / 3, (a.y + b.y + c.y) / 3);
@@ -123,6 +680,12 @@
tri2dInfo.radius = this._array[offset + 8];
tri2dInfo.radius = this._array[offset + 8];
}
}
+ /**
+ * Transform the given triangle and store its result in the array
+ * @param index The index to store the result to
+ * @param tri2dInfo The triangle to transform
+ * @param transform The transformation matrix
+ */
public transformAndStoreToTri2DInfo(index: number, tri2dInfo: Tri2DInfo, transform: Matrix) {
public transformAndStoreToTri2DInfo(index: number, tri2dInfo: Tri2DInfo, transform: Matrix) {
if (index >= this._count) {
if (index >= this._count) {
throw new Error(`Can't fetch the triangle at index ${index}, max index is ${this._count - 1}`);
throw new Error(`Can't fetch the triangle at index ${index}, max index is ${this._count - 1}`);
@@ -139,10 +702,19 @@
tri2dInfo.transformInPlace(transform);
tri2dInfo.transformInPlace(transform);
}
}
+ /**
+ * Get the element count that can be stored in this array
+ * @returns {}
+ */
public get count(): number {
public get count(): number {
return this._count;
return this._count;
}
}
+ /**
+ * Check if a given point intersects with at least one of the triangles stored in the array.
+ * If true is returned the point is intersecting with at least one triangle, false if it doesn't intersect with any of them
+ * @param p The point to check
+ */
public doesContain(p: Vector2): boolean {
public doesContain(p: Vector2): boolean {
Tri2DArray._checkInitStatics();
Tri2DArray._checkInitStatics();
let a = Tri2DArray.tempT[0];
let a = Tri2DArray.tempT[0];
@@ -156,6 +728,13 @@
return false;
return false;
}
}
+ /**
+ * Make a intersection test between two sets of triangles. The triangles of setB will be transformed to the frame of reference of the setA using the given bToATransform matrix.
+ * If true is returned at least one triangle intersects with another of the other set, otherwise false is returned.
+ * @param setA The first set of triangles
+ * @param setB The second set of triangles
+ * @param bToATransform The transformation matrix to transform the setB triangles into the frame of reference of the setA
+ */
public static doesIntersect(setA: Tri2DArray, setB: Tri2DArray, bToATransform: Matrix): boolean {
public static doesIntersect(setA: Tri2DArray, setB: Tri2DArray, bToATransform: Matrix): boolean {
+A developer should be able to quickly and easily learn to use the API.
+
+Simplicity and a low barrier to entry are must-have features of every API. If you have any second thoughts about the complexity of a design, it is almost always much better to cut the feature from the current release and spend more time to get the design right for the next release.
+
+You can always add to an API, you cannot ever remove anything from one. If the design does not feel right, and you ship it anyway, you are likely to regret having done so.
+
+That's why many of the guidelines of this document are obvious and serve only one purpose: Simplicity.
+
+## Forum and Github issues
+
+Since the very beginning, Babylon.js relies on a great forum and a tremendous community: http://www.html5gamedevs.com/forum/16-babylonjs/.
+Please use the forum for **ANY questions you may have**.
+
+Please use the Github issues **only** for:
+- Bugs
+- Feature requests
+
+We will try to enforce these rules as we consider the forum is a better place for discussions and learnings.
+
+## Pull requests
+
+We are not complicated people, but we still have some [coding guidelines](http://doc.babylonjs.com/generals/Approved_Naming_Conventions)
+Before submitting your PR, just check that everything goes well by [creating the minified version](http://doc.babylonjs.com/generals/Creating_the_Mini-fied_Version)
+
+Need help contributing, here are some links:
+ - [Gulp](https://github.com/BabylonJS/Babylon.js/tree/master/Tools/Gulp) to build from command line.
+ - [VSCode Editor](https://code.visualstudio.com/), Microsoft Code editor, see [Julian Chenard's post](http://pixelcodr.com/tutos/contribute/contribute.html) a Microsoft code editor.