o3d.Element Class Reference
Inherits
o3d.ParamObject
List of all members.
Detailed Description
An Element manages DrawElements for classes inherited from Element.
Public Member Functions
Public Properties
Parameters
Member Function Documentation
Copies all the params from a the given source_param_object to this param
object. Does not replace any currently existing params with the same name.
- Parameters:
-
| sourceParamObject |
param object to copy params from. |
Creates a DrawElement for this Element. Note that unlike
Shape.createDrawElements and Transform.createDrawElements this one will
create more than one element for the same material.
- Parameters:
-
| pack |
pack used to manage created DrawElement. |
| material |
material to use for DrawElement. If you pass null
it will use the material on this Element. This allows you to easily
setup the default (just draw as is) by passing null or setup a shadow
pass by passing in a shadow material. |
- Returns:
-
!o3d.DrawElement.The created draw element.
Creates a Param with the given name and type on the ParamObject.
Will fail if a param with the same name already exists.
- Parameters:
-
| paramName |
The name of the Param to be created. |
| paramTypeName |
The type of Param to create. Valid types are
- 'o3d.ParamBoolean'
- 'o3d.ParamBoundingBox'
- 'o3d.ParamDrawContext'
- 'o3d.ParamDrawList'
- 'o3d.ParamEffect'
- 'o3d.ParamFloat'
- 'o3d.ParamFloat2'
- 'o3d.ParamFloat3'
- 'o3d.ParamFloat4'
- 'o3d.ParamFunction'
- 'o3d.ParamInteger'
- 'o3d.ParamMaterial'
- 'o3d.ParamMatrix4'
- 'o3d.ParamParamArray'
- 'o3d.ParamRenderSurface'
- 'o3d.ParamRenderDepthStencilSurface'
- 'o3d.ParamSampler'
- 'o3d.ParamSkin'
- 'o3d.ParamSteamBank'
- 'o3d.ParamState'
- 'o3d.ParamString'
- 'o3d.ParamTexture'
- 'o3d.ParamTransform'
- 'o3d.ProjectionParamMatrix4'
- 'o3d.ProjectionInverseParamMatrix4'
- 'o3d.ProjectionTransposeParamMatrix4'
- 'o3d.ProjectionInverseTransposeParamMatrix4'
- 'o3d.ViewParamMatrix4'
- 'o3d.ViewInverseParamMatrix4'
- 'o3d.ViewTransposeParamMatrix4'
- 'o3d.ViewInverseTransposeParamMatrix4'
- 'o3d.ViewProjectionParamMatrix4'
- 'o3d.ViewProjectionInverseParamMatrix4'
- 'o3d.ViewProjectionTransposeParamMatrix4'
- 'o3d.ViewProjectionInverseTransposeParamMatrix4'
- 'o3d.WorldParamMatrix4'
- 'o3d.WorldInverseParamMatrix4'
- 'o3d.WorldTransposeParamMatrix4'
- 'o3d.WorldInverseTransposeParamMatrix4'
- 'o3d.WorldViewParamMatrix4'
- 'o3d.WorldViewInverseParamMatrix4'
- 'o3d.WorldViewTransposeParamMatrix4'
- 'o3d.WorldViewInverseTransposeParamMatrix4'
- 'o3d.WorldViewProjectionParamMatrix4'
- 'o3d.WorldViewProjectionInverseParamMatrix4'
- 'o3d.WorldViewProjectionTransposeParamMatrix4'
- 'o3d.WorldViewProjectionInverseTransposeParamMatrix4'
|
- Returns:
-
o3d.Param.The newly created Param or null on failure.
Computes the bounding box in same coordinate system as the specified
POSITION stream.
- Parameters:
-
| positionStreamIndex |
Index of POSITION stream. |
- Returns:
-
!o3d.BoundingBox.The boundingbox for this element in local space.
Searches by name for a Param defined in the object.
- Parameters:
-
| paramName |
Name to search for. |
- Returns:
-
o3d.Param.The Param with the given name, or null otherwise.
Computes the intersection of a ray in the same coordinate system as
the specified POSITION stream.
- Parameters:
-
| positionStreamIndex |
Index of POSITION stream. |
| cull |
which side of the triangles to ignore. |
| start |
position of start of ray in local space. |
| end |
position of end of ray. in local space. |
- Returns:
-
!o3d.RayIntersectionInfo.RayIntersectionInfo class. If valid() is false then something
was wrong, Check client::GetLastError(). If intersected() is true then
the ray intersected a something. position() is the exact point of
intersection.
| boolean Element.isAClassName |
( |
string |
className |
) |
[inherited from o3d.ObjectBase] |
Takes the name of a class as an argument, and returns true if this object is
either an instance of that class or derives from that class.
var t = pack.createObject('o3d.Transform');
t.isAClassName('o3d.Transform'); // true
t.isAClassName('o3d.ParamObject'); // true
t.isAClassName('o3d.Shape'); // false
- Parameters:
-
| className |
Name of class to check for. |
- Returns:
-
boolean.true if this object is a or is derived from the given class name.
Removes a Param from a ParamObject.
This function will fail if the param does not exist on this ParamObject
or if the param is unremovable.
- Parameters:
-
- Returns:
-
boolean.True if the param was removed.
Member Property Documentation
The BoundingBox for this element. If culling is on this bounding box will be
tested against the view frustum of any draw context used to render this
Element.
Default = [[0, 0, 0], [0, 0, 0]].
The concrete class name for an object derived from ObjectBase.
If you want to know if an object is of a certain type you should use
objectBase.isAClassName
var t = pack.createObject('o3d.Transform');
t.className == 'o3d.Transform'; // true
This property is read-only.
Unique id of the object.
This id will be unique, even across multiple O3D clients in the same
page.
This property is read-only.
The cull settings for this element. If true this Element will be culled
by the bounding box above compared to the view frustum it is being rendered
with.
Default = false.
Gets all the DrawElements under this Element.
Each access to this field gets the entire list so it is best to get it
just once. For example:
var drawElements = element.drawElements;
for (var i = 0; i < drawElements.length; i++) {
var drawElement = drawElements[i];
}
Note that modifications to this array [e.g. push()] will not affect
the underlying Element, while modifications to the members of the array.
will affect them.
This property is read-only.
The Material for this element.
The object's name.
Setting this has no meaning to O3D, but is useful for debugging and for
the functions Client.getObjects, Pack.getObject,
RenderNode.getRenderNodesByNameInTree and
RenderNode.getTransformsByNameInTree
which search for objects by name.
The current owner of this Draw Element. Pass in null to stop being owned.
Note: Elements are referenced by the Pack they are created in and their
owner. If the Element is removed from its Pack then setting the owner
to null will free the Element. Or, visa versa, if you set the
Element's owner to null then removing it from its Pack will free the
Element.
Gets all the param on this param object.
Each access to this field gets the entire list, so it is best to get it
just once. For example:
var params = paramObject.params;
for (var i = 0; i < params.length; i++) {
var param = params[i];
}
Note that modifications to this array [e.g. push()] will not affect
the underlying ParamObject, while modifications to the array's members
will affect them.
This property is read-only.
The priority for this element. Used to sort if this Element is drawn by a
DrawPass that is set to sort by priority.
Default = 0.
The z sort point for this element. If this Element is drawn by a DrawPass
that is set to sort by z order this value will be multiplied by the
worldViewProjection matrix to compute a z value to sort by.
Default = [0, 0, 0].
Parameter Documentation
The Material used by this Element.
The BoundingBox used by this
Element for culling.
The point to sort by when rendering this
Element in a z ordered DrawPass.
Whether or not to attempt to cull this
element based on whether or not its bounding box is in the view frustum.