00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOMTRANSFORMER_H
00020 #define GEOMTRANSFORMER_H
00021
00022 #include "pandabase.h"
00023
00024 #include "geom.h"
00025 #include "luse.h"
00026
00027 class GeomNode;
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class EXPCL_PANDA GeomTransformer {
00046 public:
00047 GeomTransformer();
00048 ~GeomTransformer();
00049
00050 bool transform_vertices(Geom *geom, const LMatrix4f &mat);
00051 bool transform_vertices(GeomNode *node, const LMatrix4f &mat);
00052
00053 bool transform_texcoords(Geom *geom, const LMatrix4f &mat);
00054 bool transform_texcoords(GeomNode *node, const LMatrix4f &mat);
00055
00056 bool set_color(Geom *geom, const Colorf &color);
00057 bool set_color(GeomNode *node, const Colorf &color);
00058
00059 bool transform_colors(Geom *geom, const LVecBase4f &scale);
00060 bool transform_colors(GeomNode *node, const LVecBase4f &scale);
00061
00062 bool apply_state(GeomNode *node, const RenderState *state);
00063
00064 private:
00065 class SourceVertices {
00066 public:
00067 INLINE bool operator < (const SourceVertices &other) const;
00068
00069 LMatrix4f _mat;
00070 PTA_Vertexf _coords;
00071 };
00072 typedef pmap<SourceVertices, PTA_Vertexf> Vertices;
00073 Vertices _vertices;
00074
00075 class SourceNormals {
00076 public:
00077 INLINE bool operator < (const SourceNormals &other) const;
00078
00079 LMatrix4f _mat;
00080 PTA_Normalf _norms;
00081 };
00082 typedef pmap<SourceNormals, PTA_Normalf> Normals;
00083 Normals _normals;
00084
00085 class SourceTexCoords {
00086 public:
00087 INLINE bool operator < (const SourceTexCoords &other) const;
00088
00089 LMatrix4f _mat;
00090 PTA_TexCoordf _texcoords;
00091 };
00092 typedef pmap<SourceTexCoords, PTA_TexCoordf> TexCoords;
00093 TexCoords _texcoords;
00094
00095
00096
00097
00098
00099 typedef pmap<Colorf, PTA_Colorf> FColors;
00100 FColors _fcolors;
00101
00102 class SourceColors {
00103 public:
00104 INLINE bool operator < (const SourceColors &other) const;
00105
00106 LVecBase4f _scale;
00107 PTA_Colorf _colors;
00108 };
00109 typedef pmap<SourceColors, PTA_Colorf> TColors;
00110 TColors _tcolors;
00111 };
00112
00113 #include "geomTransformer.I"
00114
00115 #endif
00116