00001
00002 #ifndef RC_GEOMETRY_H
00003 #define RC_GEOMETRY_H
00004
00008 class Geometry : public Transformable {
00009 friend class SceneGraph;
00010
00011 friend class Renderer;
00012 #ifdef RC_OPENGL
00013 friend class RendererGL;
00014 #endif
00015
00016
00017
00018 protected:
00019 Geometry(
00020 const char *nname
00021 );
00022
00023 Geometry(
00024 const char *nname,
00025
00026 VertexArray *vertex_array,
00027
00028 bool instantiate_resources = true
00029 );
00030
00031 Geometry(
00032 const char *nname,
00033
00034 const char *filename
00035 );
00036
00037 ~Geometry();
00038
00039 public:
00040
00041 static void registerCommands();
00042
00047 void render();
00048
00049 void setVertexArray(
00050 VertexArray *vertex_array,
00051
00052 bool instantiate_resource = true
00053 );
00054
00055 VertexArray *getVertexArray();
00056
00057
00058 void setShaderProgram(
00059 ShaderProgram *shader_program,
00060
00061 bool instantiate_resource = true
00062 );
00063
00064 ShaderProgram *getShaderProgram();
00065
00066 void setShaderProgram(
00067 ShaderProgram *shader_program,
00068
00069 char *render_pass,
00070
00071 bool instantiate_resource = true
00072 );
00073
00074 ShaderProgram *getShaderProgram(
00075 char *render_pass
00076 );
00077
00078
00079 AABox getWorldBoundingBox();
00080
00081 AABox getLocalBoundingBox();
00082
00083
00084
00085
00086
00087 void setScalar(
00088 const char *name,
00089 f32 value,
00090 UniformType_t type
00091 );
00092
00093 void setScalar(
00094 const char *name,
00095 i32 value,
00096 UniformType_t type
00097 );
00098
00099 void setScalarArray(
00100 const char *name,
00101 void *list,
00102 u32 n_values,
00103 UniformType_t type
00104 );
00105
00106
00107 void setVector(
00108 const char *name,
00109 void *vecptr,
00110 u32 dimension,
00111 UniformType_t type
00112 );
00113
00114 void setVectorArray(
00115 const char *name,
00116 void *list,
00117 u32 n_values,
00118 u32 dimension,
00119 UniformType_t type
00120 );
00121
00122 void setMatrix(
00123 const char *name,
00124 void *matptr,
00125 u32 dimension
00126 );
00127
00128 void setMatrixArray(
00129 const char *name,
00130 void *list,
00131 u32 n_values,
00132 u32 dimension
00133 );
00134
00135
00136
00137
00138 void setTexture(
00139 const char *name,
00140 Texture *tex
00141 );
00142
00143 void setCubeMap(
00144 const char *name,
00145 CubeMap *cubemap
00146 );
00147
00148
00149
00150
00151
00152 Uniform *getUniform();
00153
00154
00155 void logInfo();
00156
00157
00158 static void init();
00159
00160
00161
00162 static void setRenderPass(
00163 char *pass_name
00164 );
00165
00166 static void addRenderPass(
00167 char *pass_name
00168 );
00169
00170 static void removeRenderPass(
00171 char *pass_name
00172 );
00173
00174 static u32 getCurrentRenderPass();
00175
00176 static u32 getRenderPassIndex(
00177 char *pass_name
00178 );
00179
00180 protected:
00181
00182 void drawSelf();
00183
00184 Node *duplicateSelf();
00185
00186
00187
00188 protected:
00189 VertexArray *vertexArray;
00190
00191 ShaderProgram *shaderProgram[RC_GEOMETRY_MAX_PASSES];
00192
00193
00194 Uniform uniform;
00195
00196 static char *render_pass[RC_GEOMETRY_MAX_PASSES];
00197 static u32 curr_render_pass;
00198
00199
00200 };
00201
00202
00203 #endif
00204