StraightStairwayStructure
Summary
Stairway structure for straight stairways.
Constructor
StraightStairwayStructure
Syntax
StraightStairwayStructure
()
Summary
Item Index
Methods
Methods
add
Syntax
add
-
propertyName -
value
Summary
Adds an element to the collection in parameter.Returns:
addMaterial
Syntax
addMaterial
-
parent -
mesh -
materialItem
Summary
Adds a material.
Parameters:
-
parentBABYLON.MeshThe parent of the mesh.
-
meshBABYLON.MeshThe stairway mesh.
-
materialItemwnp.StandardMaterialThe item material.
computeSteps
Syntax
computeSteps
()
private
Summary
Compute the point of the step of a straight stairway.
deserialize
Syntax
Summary
Deserializes the object (from JSON).Parameters:
-
hybridObjectJSON describing the object, built with the method serialize.
Returns:
The Structure object built from the deserialization
draw
Syntax
draw
-
ctx -
tmpPoint
Summary
Draw the straight stairway.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
tmpPointBABYLON.Vector2The temporary position of the stairway.
drawStep
Syntax
drawStep
-
ctx -
step
Summary
Draws the step.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
stepNumberThe n-th step of the stairway.
drawStepBearing
Syntax
drawStepBearing
-
ctx -
polygon -
end
Summary
Draw the bearing.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
polygonBABYLON.Vector2The polygon points of the bearing.
-
endNumberKnow if it is the last bearing or not.
drawStepStairs
Syntax
drawStepStairs
-
ctx -
segment
Summary
Draw all the steps of the stairway.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
segmentBABYLON.Vector2The segment done by the step.
getAvailableProperties
Syntax
Summary
Gets the available properties of the object (user-customizable).
Returns:
An array containing several properties of the object.
getBoundPoints
Syntax
getBoundPoints
-
step
Summary
Get the bounding points of a step.
Parameters:
-
stepNumberThe n-th step of the stairway.
Returns:
An array of the bounding points.
getElementByName
Syntax
Summary
Gets an element of the collection by its name.Parameters:
Returns:
getFloor
Syntax
Summary
Gets the floor referencing this objectParameters:
-
collectionStringCollection to search within.
Returns:
The floor containing this structure, -1 if the object has not been added to any floor collection.
getHopperPoints
Syntax
getHopperPoints
()
BABYLON.Vector2
Summary
Gets the hopper points created by the stairway.
Returns:
The four points of the hopper carved in the upper floor.
getNormalAtPoint
Syntax
getNormalAtPoint
-
index
Summary
Gets the normal at the given index point.
Parameters:
-
indexNumberThe index of the point.
Returns:
The normal at the point.
getStepBoundPoints
Syntax
getStepBoundPoints
-
bottomIndex
Summary
Returns the 4 points of the step.
Parameters:
-
bottomIndexNumberThe index of the bottom point of the step.
Returns:
The four points of a step.
initialize
Syntax
initialize
()
private
Summary
Method called after the loading of the componentisTargeted
Syntax
Summary
Check if the stair is targeted by the given vector.
Parameters:
-
vectorBABYLON.Vector2A position, usually the one of the cursor.
Returns:
True if target by the vector.
isValid
Syntax
Summary
Checks if the stair is valid and has enough points to create the 3D mesh.
Returns:
True if valid.
remove
Syntax
remove
-
structure
Summary
Deletes the stairway.
Parameters:
-
structureFloorStructureThe structure of the floor.
serialize
Syntax
Summary
Serializes the object (to JSON)Returns:
update
Syntax
update
()
Summary
Generic update method, must be overridden.updateReferences
Syntax
updateReferences
-
structure
Summary
Generic method for rebuilding references after the deserialization. For example : restoring the link between a PointStructure and its parent WallStructureParameters:
-
structurewnp.StructureFloor Structure to work with
Properties
points
Syntax
points
BABYLON.Vector3
Summary
The points defining the path of the stairway.