vtlib library
|
Classes | |
class | vtGeomFactory |
class | vtDimension |
class | vtDynBoundBox |
class | vtLodGrid |
class | vtSimpleLodGrid |
class | vtMaterial |
class | vtMaterialArray |
class | vtMesh |
class | vtTextMesh |
struct | NodeExtension |
struct | TransformExtension |
class | vtGroup |
class | vtTransform |
class | vtFog |
class | vtShadow |
class | vtLightSource |
class | vtGeode |
class | vtMovGeode |
class | vtLOD |
class | vtCamera |
class | vtHUD |
class | vtDynGeom |
struct | vtHit |
struct | vtPrimInfo |
class | vtWindow |
class | vtScene |
Typedefs | |
typedef osg::ref_ptr< osgText::Font > | vtFontPtr |
Functions | |
vtGeode * | Create3DCursor (float fSize, float fSmall, float fAlpha=0.5f) |
vtGeode * | CreateBoundSphereGeode (const FSphere &sphere, int res=24) |
vtMesh * | CreateSphereMesh (const FSphere &sphere, int res=24) |
vtGeode * | CreateBlockGeom (const vtMaterialArray *pMats, int iMatIdx, const FPoint3 &size) |
vtGeode * | CreateSphereGeom (const vtMaterialArray *pMats, int iMatIdx, int iVertType, float fRadius, int res) |
vtGeode * | CreateCylinderGeom (const vtMaterialArray *pMats, int iMatIdx, int iVertType, float hHeight, float fRadius, int res, bool bTop=true, bool bBottom=true, bool bCentered=true, int direction=1) |
vtGeode * | CreateLineGridGeom (const vtMaterialArray *pMats, int iMatIdx, const FPoint3 &min1, const FPoint3 &max1, int steps) |
bool | WriteGeodeToOBJ (vtGeode *geode, const char *filename) |
osg::Image * | LoadOsgImage (const char *fname) |
Convenience method. More... | |
bool | FindAncestor (osg::Node *node, osg::Node *parent) |
osg::Node * | FindDescendent (osg::Group *node, const char *pName) |
void | InsertNodeAbove (osg::Node *node, osg::Group *newnode) |
void | InsertNodeBelow (osg::Group *group, osg::Group *newnode) |
void | LocalToWorld (osg::Node *node, FPoint3 &point) |
void | GetBoundSphere (osg::Node *node, FSphere &sphere, bool bGlobal=false) |
void | ApplyVertexRotation (osg::Node *node, const FPoint3 &axis, float angle) |
void | ApplyVertexTransform (osg::Node *node, const FMatrix4 &mat) |
void | vtLogGraph (osg::Node *node, bool bExtents=false, bool bRefCounts=false, int indent=0) |
void | WriteDotFile (osg::Group *node, const char *filename) |
osg::Node * | vtLoadModel (const char *filename, bool bAllowCache=true, bool bDisableMipmaps=false) |
Load a 3D model file. More... | |
int | vtIntersect (osg::Node *pTop, const FPoint3 &start, const FPoint3 &end, vtHitList &hitlist, bool bLocalCoords=false, bool bNativeNodes=true) |
void | GetNodeBoundBox (osg::Node *node, FBox3 &box) |
void | GetNodePrimCounts (osg::Node *node, vtPrimInfo &info) |
These classes define the node of a scene graph and the Scene class which contains them.
typedef osg::ref_ptr<osgText::Font> vtFontPtr |
A Font for use with vtTextMesh.
void ApplyVertexRotation | ( | osg::Node * | node, |
const FPoint3 & | axis, | ||
float | angle | ||
) |
Given a node with geometry under it, rotate the vertices of that geometry by a given axis/angle.
void ApplyVertexTransform | ( | osg::Node * | node, |
const FMatrix4 & | mat | ||
) |
Given any node with geometry under it, transform the vertices of that geometry.
vtGeode* Create3DCursor | ( | float | fSize, |
float | fSmall, | ||
float | fAlpha | ||
) |
Create a "3d Cursor" geometry, which consists of 3 blocks (red, green, blue) along the XYZ axes.
fSize | The overall width, height, and depth of the geometry |
fSmall | The width of the blocks (generally much smaller than fSize) |
fAlpha | The alpha value to use, from 0 (transparent) to 1 (opaque) |
vtGeode* CreateBlockGeom | ( | const vtMaterialArray * | pMats, |
int | iMatIdx, | ||
const FPoint3 & | size | ||
) |
Create a block geometry with the indicated material and size. See vtMesh::CreateBlock for how the block is constructed.
pMats | The array of materials to use. |
iMatIdx | The index of the material to use. |
size | The dimensions of the block in x, y, z. |
Create a wireframe sphere which is very useful for visually representing the bounding sphere of an object in the scene.
vtGeode* CreateCylinderGeom | ( | const vtMaterialArray * | pMats, |
int | iMatIdx, | ||
int | iVertType, | ||
float | fHeight, | ||
float | fRadius, | ||
int | res, | ||
bool | bTop, | ||
bool | bBottom, | ||
bool | bCentered, | ||
int | direction | ||
) |
Create a cylinder geometry with the indicated attributes.
pMats | The array of materials to use. |
iMatIdx | The index of the material to use. |
iVertType | Flags which indicate what type of information is stored with each vertex. This can be any combination of the following bit flags:
|
fHeight | The height of the cylinder. |
fRadius | The radius of the cylinder. |
res | The resolution (number of sides) of the cylinder. |
bTop | True to create the top of the cylinder. |
bBottom | True to create the bottom of the cylinder. You could set this to false, for example, if the cylinder is going to sit on a flat surface where you will never see its bottom. |
bCentered | True to create a cylinder centered around its origin, false for a cylinder with its base at the origin that extends outward. |
direction | An orientation, 0-2 corresponds to X, Y, Z. Default is 1 (Y). |
vtGeode* CreateLineGridGeom | ( | const vtMaterialArray * | pMats, |
int | iMatIdx, | ||
const FPoint3 & | min1, | ||
const FPoint3 & | max1, | ||
int | steps | ||
) |
Create a grid of lines in the XZ plane. This can be useful as a reference object, like a sheet of graph paper.
vtGeode* CreateSphereGeom | ( | const vtMaterialArray * | pMats, |
int | iMatIdx, | ||
int | iVertType, | ||
float | fRadius, | ||
int | res | ||
) |
Create a sphere geometry with the indicated material, radius and resolution.
pMats | The array of materials to use. |
iMatIdx | The index of the material to use. |
iVertType | Flags which indicate what type of information is stored with each vertex. This can be any combination of the following bit flags:
|
fRadius | The radius of the sphere. |
res | The resolution (tesselation) of the sphere. The number of vertices in the result will be res*res*2. |
Create a wireframe sphere which is very useful for visually representing the bounding sphere of an object in the scene.
bool FindAncestor | ( | osg::Node * | node, |
osg::Node * | parent | ||
) |
Recursively travel up the scene graph, looking for a specific parent node. Return true if it is found.
osg::Node* FindDescendent | ( | osg::Group * | group, |
const char * | pName | ||
) |
Recursively travel down the scene graph, looking for a specific child node by name. Return it if it is found.
void GetBoundSphere | ( | osg::Node * | node, |
FSphere & | sphere, | ||
bool | bGlobal | ||
) |
Get the Bounding Sphere of the node
void GetNodeBoundBox | ( | osg::Node * | node, |
FBox3 & | box | ||
) |
Calculates the bounding box of the geometry contained in and under this node in the scene graph. Note that unlike the bounding sphere which is cached, this value is calculated each time this method is called.
node | The node to visit. |
box | Will receive the bounding box. |
void GetNodePrimCounts | ( | osg::Node * | node, |
vtPrimInfo & | info | ||
) |
This method walks through a node (and all its children), collecting information about all the geometric primitives. The result is placed in an object of type vtPrimInfo. This includes information such as number of vertices, number of triangles, and so forth. Note that this can be a time-consuming operation if your geometry is large or complex. The results are not cached, so this method should be called only when needed.
node | The node to investigate. |
info | A vtPrimInfo object which will receive all the information about this node and its children. |
void InsertNodeAbove | ( | osg::Node * | node, |
osg::Group * | newnode | ||
) |
Insert a node into a scene graph. For example, if the graph is A-B-C, where B is the child of A and C is the child of B, then inserting a node D above C results in A-B-D-C.
node | The node to insert above. |
newnode | The node to insert. |
void InsertNodeBelow | ( | osg::Group * | group, |
osg::Group * | newnode | ||
) |
Insert a node into a scene graph. For example, if the graph is A-B-C, where B is the child of A and C is the child of B, then inserting a node D below A results in A-D-B-C.
group | The node to insert below. |
newnode | The node to insert. |
osg::Image* LoadOsgImage | ( | const char * | fname | ) |
Load an image.
void LocalToWorld | ( | osg::Node * | node, |
FPoint3 & | point | ||
) |
Transform a 3D point from a node's local frame of reference to world coordinates. This is done by walking the scene graph upwards, applying all transforms that are encountered.
node | The node to consider. |
point | A reference to the input point is modified in-place with world coordinate result. |
int vtIntersect | ( | osg::Node * | pTop, |
const FPoint3 & | start, | ||
const FPoint3 & | end, | ||
vtHitList & | hitlist, | ||
bool | bLocalCoords, | ||
bool | bNativeNodes | ||
) |
Check for surface intersections along a line segment in space.
pTop | The top of the scene graph that you want to search for intersections. This can be the root node if you want to seach your entire scene, or any other node to search a subgraph. |
start | The start point (world coordinates) of the line segment. |
end | The end point (world coordinates) of the line segment. |
hitlist | The results. If there are intersections (hits), they are placed in this list, which is simply a std::vector of vtHit objects. Each vtHit object gives information about the hit point. |
bLocalCoords | Pass true to get your results in local coordinates (in the frame of the object which was hit). Otherwise, result points are in world coordinates. |
bNativeNodes | Pass true to return the internal (native) scene graph node that was hit, when there is no corresponding vtNode. Pass false to always return a vtNode, by looking up the scene graph as needed. |
osg::Node* vtLoadModel | ( | const char * | filename, |
bool | bAllowCache, | ||
bool | bDisableMipmaps | ||
) |
Load a 3D model from a file.
The underlying scenegraph (i.e. OSG) is used to load the model, which is returned as an osg::Node. You can then use this node normally, for example add it to your scenegraph with addChild(), or to your terrain's subgraph with vtTerrain::AddNode().
filename | The filename to load from. |
bAllowCache | Default is true, to allow OSG to cache models. This means that if you load from the same filename more than once, you will get the same model again instantly. If you don't want this, for example if the model has changed on disk and you want to force loading, pass false. |
bDisableMipmaps | Pass true to turn off mipmapping in the texture maps in the loaded model. Default is false (enable mipmapping). |
void vtLogGraph | ( | osg::Node * | node, |
bool | bExtents, | ||
bool | bRefCounts, | ||
int | indent | ||
) |
Diagnostic function to help debugging: Log the scene graph from a given node downwards.
void WriteDotFile | ( | osg::Group * | node, |
const char * | filename | ||
) |
Write the scene graph to a file for use with the 'dot' graphing application which is part of GraphViz (http://www.graphviz.org/).
For example, to write the whole scenegraph to a file:
Then to use dot to produce a visual graph, from a command line:
bool WriteGeodeToOBJ | ( | vtGeode * | geode, |
const char * | filename | ||
) |
Write a geometry node to a old-fashioned Wavefront OBJ file.