00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "geomIssuer.h"
00020 #include <geom.h>
00021 #include <graphicsStateGuardianBase.h>
00022
00023 static void
00024 issue_vertex_noop(const Geom *, Geom::VertexIterator &,
00025 GraphicsStateGuardianBase *) {
00026 }
00027
00028 static void
00029 issue_normal_noop(const Geom *, Geom::NormalIterator &,
00030 GraphicsStateGuardianBase *) {
00031 }
00032
00033 static void
00034 issue_texcoord_noop(const Geom *, Geom::TexCoordIterator &,
00035 GraphicsStateGuardianBase *) {
00036 }
00037
00038 static void
00039 issue_color_noop(const Geom *, Geom::ColorIterator &,
00040 GraphicsStateGuardianBase *) {
00041 }
00042
00043 static GeomIssuer noop_issuer;
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 GeomIssuer::
00055 GeomIssuer() {
00056 for (int i = 0; i < num_GeomBindTypes; i++) {
00057 _vertex_command[i] = issue_vertex_noop;
00058 _normal_command[i] = issue_normal_noop;
00059 _texcoord_command[i] = issue_texcoord_noop;
00060 _color_command[i] = issue_color_noop;
00061 }
00062 _geom = NULL;
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 GeomIssuer::
00079 GeomIssuer(const Geom *geom,
00080 GraphicsStateGuardianBase *gsg,
00081 IssueVertex *vertex,
00082 IssueNormal *normal,
00083 IssueTexCoord *texcoord,
00084 IssueColor *color) {
00085 memcpy(this, &noop_issuer, sizeof(GeomIssuer));
00086 _geom = geom;
00087 _gsg = gsg;
00088
00089
00090
00091 if (vertex != NULL) {
00092 _vertex_command[geom->get_binding(G_COORD)] = vertex;
00093 }
00094
00095
00096 if (normal != NULL && gsg->wants_normals()) {
00097 _normal_command[geom->get_binding(G_NORMAL)] = normal;
00098 }
00099
00100
00101 if (texcoord != NULL && gsg->wants_texcoords()) {
00102 _texcoord_command[geom->get_binding(G_TEXCOORD)] = texcoord;
00103 }
00104
00105
00106 if (color != NULL && gsg->wants_colors()) {
00107 _color_command[geom->get_binding(G_COLOR)] = color;
00108 }
00109 }