DrawElements (object)¶
The DrawElements allows to define a simple mix of points, lines and triangles for debug drawing purposes.
Members¶
GeometryAttributes | attributes | Container for all attributes. |
String | debugName | Name that will be printed in descriptions. |
UInt32 | structureVersion | Version of the geometry structure itself, excluding the GeometryAttributes content. |
Boolean | computeGPUBoundingVolume | If positions are on the GPU: if true, the bounding volume is computed, else an infinite bbox is returned. |
ThreadsafeMetaDataContainer | metaData | Container for holding various user data (Geometry specific), such as the BoundingBox cache data, or raycast acceleration structures and data (Octree). |
Scalar | pointSize | Point size in pixels |
Scalar | lineWidth | Line width in pixels |
/*
** Example: DrawElements
*/
require Geometry;
operator entry() {
DrawElements elements('debug');
// draw a couple of points
elements.drawPoint(Vec3(5, 0, 0));
elements.drawPoint(Vec3(0, 5, 0));
elements.drawPoint(Vec3(0, 0, 5));
// draw a couple of lines
elements.drawLine(Vec3(0, 0, 0), Vec3(5, 0, 0));
elements.drawLine(Vec3(0, 0, 0), Vec3(0, 5, 0));
elements.drawLine(Vec3(0, 0, 0), Vec3(0, 0, 5));
// for more methods check the method description below.
}
/*
** Output:
*/
Methods¶
DrawElements ( in DrawElements other ) | |
DrawElements ( in String name ) | |
DrawElements () | |
Index | allocateLines ! ( in Size nbPoints, in Size nbLines ) |
Index | allocatePoints ! ( in Size nbPoints ) |
Index | allocateTriangles ! ( in Size nbPoints, in Size nbTriangles ) |
Index | allocateVertices ! ( in Size nbVertices ) |
clear ! () | |
DrawElements | clone ? () |
cloneMembersTo ? ( io DrawElements that ) | |
copy ! ( in DrawElements src ) | |
copy ! ( in Geometry src ) | |
disablePen ! () | |
DrawElements | drawArc ! ( in Xfo xfo, in Scalar radius, in Vec2 angleMinMax, in UInt32 detail ) |
DrawElements | drawAxes ! ( in Xfo xfo, in Boolean bothSides ) |
DrawElements | drawBBox ! ( in Xfo xfo, in Vec3 bboxmin, in Vec3 bboxmax ) |
DrawElements | drawCapsuleLines ! ( in Xfo xfo, in Scalar radius, in Scalar height, in UInt32 detail ) |
DrawElements | drawCircle ! ( in Xfo xfo, in Scalar radius, in UInt32 detail ) |
DrawElements | drawLine ! ( in Vec3 from, in Vec3 to ) |
DrawElements | drawLineStrip ! ( in Vec3 points[] ) |
DrawElements | drawPoint ! ( in Vec3 pos ) |
DrawElements | drawSegmentedLine ! ( in Vec3 from, in Vec3 to, in Size numSegments ) |
DrawElements | drawSegmentedLine ! ( in Vec3 from, in Vec3 to, in Size numSegments, in Scalar ratio ) |
DrawElements | drawSphereLines ! ( in Xfo xfo, in Scalar radius, in UInt32 detail ) |
DrawElements | drawSquare ! ( in Xfo xfo, in Scalar length, in Scalar width ) |
DrawElements | drawTriangle ! ( in Vec3 p0, in Vec3 p1, in Vec3 p2 ) |
DrawElements | drawTriangle ! ( in Vec3 p0, in Vec3 p1, in Vec3 p2, in Vec3 n ) |
DrawElements | drawTriangle ! ( in Vec3 p0, in Vec3 p1, in Vec3 p2, in Vec3 n0, in Vec3 n1, in Vec3 n2 ) |
DrawElements | drawTrianglesCone ! ( in Xfo xfo, in Scalar radius, in Scalar height, in UInt32 detail ) |
DrawElements | drawTrianglesCube ! ( in Xfo xfo, in Scalar width, in Scalar height, in Scalar length ) |
DrawElements | drawTrianglesPlane ! ( in Xfo xfo, in Scalar width, in Scalar height ) |
DrawElements | drawTrianglesSphere ! ( in Xfo xfo, in Scalar radius, in UInt32 detail ) |
Size | elementCount ? () |
Ref<GeometryAttributes> | getAttributes ? () |
LocalBoundingVolume | getBoundingVolume ? () |
String | getDebugName ? () |
String | getDesc ? ( in Boolean withAttributes, in Boolean useUnitTestPrint ) |
LocalBoundingVolume | getElementBoundingVolume ? ( in Size index ) |
Scalar | getLineWidth ? () |
Ref<ThreadsafeMetaDataContainer> | getMetaData ? () |
Vec3 | getPointPosition ? ( in Size point ) |
Scalar | getPointSize ? () |
UInt32 | getStructureVersion ? () |
UInt32 | getVersion ? () |
init ! ( in String name ) | |
reset ! () | |
setLineWidth ! ( in Scalar value ) | |
setPen ! ( in Color color ) | |
setPointPosition ! ( in Size point, in Vec3 position ) | |
setPointSize ! ( in Scalar value ) |
Methods in detail¶
DrawElements ( in DrawElements other )
copy constructor
DrawElements ( in String name )
DrawElements ()
default constructor
Index DrawElements.allocateLines! ( in Size nbPoints, in Size nbLines )
allocates space for new lines
Index DrawElements.allocatePoints! ( in Size nbPoints )
allocates space for new points
Index DrawElements.allocateTriangles! ( in Size nbPoints, in Size nbTriangles )
allocates space for new lines
Index DrawElements.allocateVertices! ( in Size nbVertices )
allocates space for new vertices
DrawElements.clear! ()
clears the content of the DrawElements
DrawElements DrawElements.clone? ()
clone method
DrawElements.cloneMembersTo? ( io DrawElements that )
DrawElements.copy! ( in DrawElements src )
Copies the content from the source Points.
DrawElements.copy! ( in Geometry src )
Copies the content from the source Geometry.
DrawElements.disablePen! ()
disables the current pen
DrawElements DrawElements.drawArc! ( in Xfo xfo, in Scalar radius, in Vec2 angleMinMax, in UInt32 detail )
draws a line arc around the Y axis given a transform for the arc, a radius, a angular min and max as a Vec3 and a detail setting. the detail describes the number of line segments of the circle (minimum of 3).
angleMinMax | [minAngle, maxAngle], in radians |
DrawElements DrawElements.drawAxes! ( in Xfo xfo, in Boolean bothSides )
draws a cross given a transform
DrawElements DrawElements.drawBBox! ( in Xfo xfo, in Vec3 bboxmin, in Vec3 bboxmax )
draws a line bounding box given a transform for the box, a minimum and maximum position.
DrawElements DrawElements.drawCapsuleLines! ( in Xfo xfo, in Scalar radius, in Scalar height, in UInt32 detail )
draws a capsule shape using lines. the detail describes the number of line segments for each circle (minimum of 3).
DrawElements DrawElements.drawCircle! ( in Xfo xfo, in Scalar radius, in UInt32 detail )
draws a line circle around the Y axis given a transform for the circle, a radius and a detail setting. the detail describes the number of line segments of the circle (minimum of 3).
DrawElements DrawElements.drawLine! ( in Vec3 from, in Vec3 to )
draws a line given two positions
DrawElements DrawElements.drawLineStrip! ( in Vec3 points[] )
draws a line through all of the points provided
DrawElements DrawElements.drawPoint! ( in Vec3 pos )
draws a single point given a position
DrawElements DrawElements.drawSegmentedLine! ( in Vec3 from, in Vec3 to, in Size numSegments )
overloaded method, uses 0.5 for the ratio
DrawElements DrawElements.drawSegmentedLine! ( in Vec3 from, in Vec3 to, in Size numSegments, in Scalar ratio )
draws a segmented line given two positions, a number of segmentation segments (minimum of 2) and a segment ratio (0.0 to 1.0).
DrawElements DrawElements.drawSphereLines! ( in Xfo xfo, in Scalar radius, in UInt32 detail )
draws three line circles representing a sphere given a transform for the sphere, a radius and a detail setting. the detail describes the number of line segments for each circle (minimum of 3).
DrawElements DrawElements.drawSquare! ( in Xfo xfo, in Scalar length, in Scalar width )
draws a line square given a transform for the square, a length (along X), a width (along Z).
DrawElements DrawElements.drawTriangle! ( in Vec3 p0, in Vec3 p1, in Vec3 p2 )
draws a single triangle given only three positions
DrawElements DrawElements.drawTriangle! ( in Vec3 p0, in Vec3 p1, in Vec3 p2, in Vec3 n )
draws a single triangle given three positions and a single normal
DrawElements DrawElements.drawTriangle! ( in Vec3 p0, in Vec3 p1, in Vec3 p2, in Vec3 n0, in Vec3 n1, in Vec3 n2 )
draws a single triangle given three positions and three normals
DrawElements DrawElements.drawTrianglesCone! ( in Xfo xfo, in Scalar radius, in Scalar height, in UInt32 detail )
draws a triangle cone given a transform for the cone, a radius, a height (along Y) and a detail setting. the detail setting describes the segmentation of the cone circle (minimum of 3).
DrawElements DrawElements.drawTrianglesCube! ( in Xfo xfo, in Scalar width, in Scalar height, in Scalar length )
draws a triangle cube given a transform for the cube, a width (along X), a height (along Y), a length (along Z).
DrawElements DrawElements.drawTrianglesPlane! ( in Xfo xfo, in Scalar width, in Scalar height )
draws a triangle plane given a transform for the plane, a width (along X), a height (along Z).
DrawElements DrawElements.drawTrianglesSphere! ( in Xfo xfo, in Scalar radius, in UInt32 detail )
draws a triangle sphere given a transform for the sphere, a radius and a detail setting. the detail setting describes the number of segments along u and v of the sphere (minimum of 3).
Size DrawElements.elementCount? ()
Returns the number of elements for this Geometry. Elements are geometry specific: polygons for PolygonMesh, line segments for Lines, points for Points...
Ref<GeometryAttributes> DrawElements.getAttributes? ()
Returns the associated attribute container, if any.
注釈
the usage and meaning of attribute values is geometry specific.
LocalBoundingVolume DrawElements.getBoundingVolume? ()
Returns the local bounding volume of the geometry (typically a bounding box around the point positions)
String DrawElements.getDebugName? ()
Returns the debug name used when constructing the geometry.
String DrawElements.getDesc? ( in Boolean withAttributes, in Boolean useUnitTestPrint )
Returns a description of the Geometry.
withAttributes | If true, will print all attributes and their values |
useUnitTestPrint | If true, floats will use a numerically stable, unit test friendly output |
LocalBoundingVolume DrawElements.getElementBoundingVolume? ( in Size index )
Element index: points then lines then triangles
Scalar DrawElements.getLineWidth? ()
return the current line width used
Ref<ThreadsafeMetaDataContainer> DrawElements.getMetaData? ()
Returns the metaData container for this Geometry.
Vec3 DrawElements.getPointPosition? ( in Size point )
returns the position of a point.
Scalar DrawElements.getPointSize? ()
return the current point size used
UInt32 DrawElements.getStructureVersion? ()
Returns the version of the geometry structure including the the attribute set (but not attribute values).
UInt32 DrawElements.getVersion? ()
Returns the version of the geometry including attribute values
DrawElements.init! ( in String name )
DrawElements.reset! ()
resets all offsets of this DrawElements
DrawElements.setLineWidth! ( in Scalar value )
sets the current line width used
DrawElements.setPen! ( in Color color )
sets the current pen
DrawElements.setPointPosition! ( in Size point, in Vec3 position )
sets the positions of a point.
DrawElements.setPointSize! ( in Scalar value )
sets the current point size used