|
|
|
An object specifically designed to transform the vertices of a Geom without disturbing indexing or affecting any other Geoms that may share the same vertex arrays, and without needlessly wasting memory when different Geoms sharing the same vertex arrays are transformed by the same amount.
More...
#include "geomTransformer.h"
List of all members.
Classes |
| class | AlreadyCollectedData |
| class | NewCollectedData |
| class | NewCollectedKey |
| class | NewVertexData |
| class | SourceColors |
| class | SourceData |
| class | SourceFormat |
| class | SourceGeom |
| class | SourceTexCoords |
| class | SourceTextureColors |
| class | SourceVertices |
| class | VertexDataAssoc |
Public Member Functions |
|
| GeomTransformer (const GeomTransformer ©) |
| bool | apply_state (GeomNode *node, const RenderState *state) |
| | Applies the indicated render state to all the of Geoms.
|
| bool | apply_texture_colors (Geom *geom, TextureStage *ts, Texture *tex, const TexMatrixAttrib *tma, const LColor &base_color, bool keep_vertex_color) |
| | Removes textures from Geoms by applying the texture colors to the vertices.
|
| bool | apply_texture_colors (GeomNode *node, const RenderState *state) |
| | Removes textures from Geoms by applying the texture colors to the vertices.
|
| int | collect_vertex_data (Geom *geom, int collect_bits, bool format_only) |
| | Collects together GeomVertexDatas from different geoms into one big (or several big) GeomVertexDatas.
|
| int | collect_vertex_data (GeomNode *node, int collect_bits, bool format_only) |
| | Collects together individual GeomVertexData structures that share the same format into one big GeomVertexData structure.
|
| bool | doubleside (GeomNode *node) |
| | Duplicates triangles in this GeomNode so that each triangle is back-to-back with another triangle facing in the opposite direction.
|
| void | finish_apply () |
| | Should be called after performing any operations--particularly PandaNode::apply_attribs_to_vertices()--that might result in new GeomVertexData objects being duplicated and modified.
|
| int | finish_collect (bool format_only) |
| | This should be called after a call to collect_vertex_data() to finalize the changes and apply them to the vertices in the graph.
|
| int | get_max_collect_vertices () const |
| | Returns the maximum number of vertices that may be put into a single GeomVertexData as a result of collecting multiple objects in collect_vertex_data().
|
| bool | make_compatible_state (GeomNode *node) |
| | Checks if the different geoms in the GeomNode have different RenderStates.
|
|
| PT (Geom) premunge_geom(const Geom *geom |
| void | register_vertices (Geom *geom, bool might_have_unused) |
| | Records the association of the Geom with its GeomVertexData, for the purpose of later removing unused vertices.
|
| void | register_vertices (GeomNode *node, bool might_have_unused) |
| | Records the association of the Geom with its GeomVertexData, for the purpose of later removing unused vertices.
|
| bool | remove_column (Geom *geom, const InternalName *column) |
| | Removes the named column from the vertex data in the Geom.
|
| bool | remove_column (GeomNode *node, const InternalName *column) |
| | Removes the named column from the vertex datas within the GeomNode.
|
| bool | reverse (GeomNode *node) |
| | Reverses the winding order of triangles in this GeomNode so that each triangle is facing in the opposite direction.
|
| bool | reverse_normals (Geom *geom) |
| | Reverses the lighting normals on the vertex data, if any.
|
| bool | set_color (Geom *geom, const LColor &color) |
| | Overrides the color indicated within the Geom with the given replacement color.
|
| bool | set_color (GeomNode *node, const LColor &color) |
| | Overrides the color indicated within the GeomNode with the given replacement color.
|
| bool | set_format (Geom *geom, const GeomVertexFormat *new_format) |
| | Changes the GeomVertexData of the indicated Geom to use the specified format.
|
| void | set_max_collect_vertices (int max_collect_vertices) |
| | Specifies the maximum number of vertices that may be put into a single GeomVertexData as a result of collecting multiple objects in collect_vertex_data().
|
| bool | transform_colors (Geom *geom, const LVecBase4 &scale) |
| | Transforms the colors in the indicated Geom by the indicated scale.
|
| bool | transform_colors (GeomNode *node, const LVecBase4 &scale) |
| | Transforms the colors in all of the Geoms within the indicated GeomNode by the indicated scale.
|
| bool | transform_texcoords (Geom *geom, const InternalName *from_name, InternalName *to_name, const LMatrix4 &mat) |
| | Transforms the texture coordinates in the indicated Geom by the indicated matrix.
|
| bool | transform_texcoords (GeomNode *node, const InternalName *from_name, InternalName *to_name, const LMatrix4 &mat) |
| | Transforms the texture coordinates in all of the Geoms within the indicated GeomNode by the indicated matrix.
|
| bool | transform_vertices (Geom *geom, const LMatrix4 &mat) |
| | Transforms the vertices and the normals in the indicated Geom by the indicated matrix.
|
| bool | transform_vertices (GeomNode *node, const LMatrix4 &mat) |
| | Transforms the vertices and the normals in all of the Geoms within the indicated GeomNode by the indicated matrix.
|
Static Public Member Functions |
|
static void | init_type () |
Public Attributes |
|
GeomMunger * | munger |
Detailed Description
An object specifically designed to transform the vertices of a Geom without disturbing indexing or affecting any other Geoms that may share the same vertex arrays, and without needlessly wasting memory when different Geoms sharing the same vertex arrays are transformed by the same amount.
If you create a single GeomTransformer and use it to transform a number of different Geoms by various transformations, then those Geoms which happen to share the same arrays and are transformed by the same amounts will still share the same arrays as each other (but different from the original arrays).
Definition at line 46 of file geomTransformer.h.
Member Function Documentation
Applies the indicated render state to all the of Geoms.
Returns true if the GeomNode was changed, false otherwise.
Definition at line 686 of file geomTransformer.cxx.
Removes textures from Geoms by applying the texture colors to the vertices.
See apply_texure_colors(GeomNode *, RenderState *).
Definition at line 422 of file geomTransformer.cxx.
References LMatrix4f::almost_equal(), TexMatrixAttrib::get_mat(), GeomVertexColumn::get_num_components(), TextureStage::get_texcoord_name(), TexMatrixAttrib::has_stage(), LMatrix4f::ident_mat(), set_color(), Geom::set_vertex_data(), and transform_colors().
Referenced by GeomNode::apply_attribs_to_vertices(), and apply_texture_colors().
Removes textures from Geoms by applying the texture colors to the vertices.
This is primarily useful to simplify a low-LOD model.
Only the bottommost texture is used (if there is more than one), and it is applied as if it were M_modulate, and WM_repeat, regardless of its actual settings. If the texture has a simple_ram_image, this may be used if the main image isn't resident.
After this call, there will be no texturing specified on the GeomNode level. Of course, there might still be texturing inherited from above.
Definition at line 624 of file geomTransformer.cxx.
References apply_texture_colors().
Duplicates triangles in this GeomNode so that each triangle is back-to-back with another triangle facing in the opposite direction.
If the geometry has vertex normals, this will also duplicate and reverse the normals, so that lighting will work correctly from both sides. Note that calling this when the geometry is already doublesided (with back-to-back polygons) will result in multiple redundant coplanar polygons.
Also see CullFaceAttrib, which can enable rendering of both sides of a triangle without having to duplicate it (but which doesn't necessarily work in the presence of lighting).
Returns true if any Geoms are modified, false otherwise.
Definition at line 930 of file geomTransformer.cxx.
References GeomNode::add_geom(), GeomNode::get_geom_state(), GeomNode::get_num_geoms(), and reverse_normals().
Reverses the winding order of triangles in this GeomNode so that each triangle is facing in the opposite direction.
If the geometry has vertex normals, this will also reverse the normals, so that lighting will work correctly.
Also see CullFaceAttrib, which can effectively change the facing of a triangle having to modify its vertices (but which doesn't necessarily work in the presence of lighting).
Returns true if any Geoms are modified, false otherwise.
Definition at line 972 of file geomTransformer.cxx.
References GeomNode::get_num_geoms(), and reverse_normals().
Transforms the colors in all of the Geoms within the indicated GeomNode by the indicated scale.
Does not destructively change Geoms; instead, a copy will be made of each Geom to be changed, in case multiple GeomNodes reference the same Geom. Returns true if the GeomNode was changed, false otherwise.
Definition at line 394 of file geomTransformer.cxx.
References transform_colors().
Transforms the texture coordinates in all of the Geoms within the indicated GeomNode by the indicated matrix.
Does not destructively change Geoms; instead, a copy will be made of each Geom to be changed, in case multiple GeomNodes reference the same Geom. Returns true if the GeomNode was changed, false otherwise.
Definition at line 262 of file geomTransformer.cxx.
References transform_texcoords().
The documentation for this class was generated from the following files:
| | |