StraightStairwayStructure Class
Stairway structure for straight stairways.
Constructor
StraightStairwayStructure
()
Item Index
Methods
Methods
add
-
propertyName
-
value
Returns:
addMaterial
-
parent
-
mesh
-
materialItem
Adds a material.
Parameters:
-
parent
BABYLON.MeshThe parent of the mesh.
-
mesh
BABYLON.MeshThe stairway mesh.
-
materialItem
wnp.StandardMaterialThe item material.
computeSteps
()
private
Compute the point of the step of a straight stairway.
deserialize
-
hybrid
Parameters:
-
hybrid
ObjectJSON describing the object, built with the method serialize.
Returns:
The Structure object built from the deserialization
draw
-
ctx
-
tmpPoint
Draw the straight stairway.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
tmpPoint
BABYLON.Vector2The temporary position of the stairway.
drawStep
-
ctx
-
step
Draws the step.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
step
NumberThe n-th step of the stairway.
drawStepBearing
-
ctx
-
polygon
-
end
Draw the bearing.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
polygon
BABYLON.Vector2The polygon points of the bearing.
-
end
NumberKnow if it is the last bearing or not.
drawStepStairs
-
ctx
-
segment
Draw all the steps of the stairway.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
segment
BABYLON.Vector2The segment done by the step.
getAvailableProperties
()
Object[]
Gets the available properties of the object (user-customizable).
Returns:
An array containing several properties of the object.
getBoundPoints
-
step
Get the bounding points of a step.
Parameters:
-
step
NumberThe n-th step of the stairway.
Returns:
An array of the bounding points.
getElementByName
-
name
-
collection
Parameters:
Returns:
getFloor
-
collection
Parameters:
-
collection
StringCollection to search within.
Returns:
The floor containing this structure, -1 if the object has not been added to any floor collection.
getHopperPoints
()
BABYLON.Vector2
Gets the hopper points created by the stairway.
Returns:
The four points of the hopper carved in the upper floor.
getNormalAtPoint
-
index
Gets the normal at the given index point.
Parameters:
-
index
NumberThe index of the point.
Returns:
The normal at the point.
getStepBoundPoints
-
bottomIndex
Returns the 4 points of the step.
Parameters:
-
bottomIndex
NumberThe index of the bottom point of the step.
Returns:
The four points of a step.
initialize
()
private
isTargeted
-
vector
Check if the stair is targeted by the given vector.
Parameters:
-
vector
BABYLON.Vector2A position, usually the one of the cursor.
Returns:
True if target by the vector.
isValid
()
Boolean
Checks if the stair is valid and has enough points to create the 3D mesh.
Returns:
True if valid.
remove
-
structure
Deletes the stairway.
Parameters:
-
structure
FloorStructureThe structure of the floor.
serialize
()
Object
Returns:
update
()
updateReferences
-
structure
Parameters:
-
structure
wnp.StructureFloor Structure to work with
Properties
points
BABYLON.Vector3
The points defining the path of the stairway.