本文整理汇总了C++中Model::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetData方法的具体用法?C++ Model::GetData怎么用?C++ Model::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render_teapot_refraction
static int render_teapot_refraction(GzRender* in_renderer)
{
//setup shader and teapot material
in_renderer->v_shader = GouraudVertexShader;
in_renderer->p_shader = GouraudAlphaPixelShader;
//use the same material for ambient, diffuse and specular
GzColor material_color = {0.7f, 0.3f, 0.1f};
for(int i=0; i<3; i++)
{
in_renderer->Ka[i] = material_color[i];
in_renderer->Kd[i] = material_color[i];
in_renderer->Ks[i] = material_color[i];
}
in_renderer->spec = 32;
//setup transform
GzMatrix m;
GzScaleMat(teapot_scale, m);
GzPushMatrix(in_renderer, m);
GzCoord pos = {teapot_position[0], teapot_position[1]/1.33f, teapot_position[2]};
GzTrxMat(pos, m);
GzPushMatrix(in_renderer, m);
GzTrxMat(teapot_rotation, m);
GzPushMatrix(in_renderer, m);
GzPutCamera(renderer, &default_camera);
GzBeginRender(in_renderer);
GzToken nameListTriangle[4]; /* vertex attribute names */
GzPointer valueListTriangle[4]; /* vertex attribute pointers */
nameListTriangle[0] = GZ_POSITION;
nameListTriangle[1] = GZ_NORMAL;
nameListTriangle[2] = GZ_TEXTURE_INDEX;
nameListTriangle[3] = GZ_RGB_COLOR;
const Model::TriangleVector& triangles = teapot_model.GetData();
for(Model::TriangleVector::const_iterator it = triangles.begin(); it != triangles.end(); it++)
{
valueListTriangle[0] = (GzPointer)(*it)->vertices;
valueListTriangle[1] = (GzPointer)(*it)->normals;
valueListTriangle[2] = (GzPointer)(*it)->uvs;
GzPutTriangle(in_renderer, 3, nameListTriangle, valueListTriangle);
}
return GZ_SUCCESS;
}
示例2: render_water_plane
static int render_water_plane(GzRender* in_renderer)
{
//setup shader and teapot material
in_renderer->v_shader = PhongVertexShader;
in_renderer->p_shader = PhongPixelShader;
//use the same material for ambient, diffuse and specular
GzColor material_color = {0.04f, 0.4f, 0.6f};
for(int i=0; i<3; i++)
{
in_renderer->Ka[i] = material_color[i];
in_renderer->Kd[i] = material_color[i];
in_renderer->Ks[i] = material_color[i];
}
in_renderer->spec = 32;
GzPutCamera(renderer, &default_camera);
//setup transform
GzCoord scale = {3.0f, 1.0f, 1.5f};
GzMatrix m;
GzScaleMat(scale,m);
GzPushMatrix(in_renderer, m);
GzBeginRender(in_renderer);
GzToken nameListTriangle[4]; /* vertex attribute names */
GzPointer valueListTriangle[4]; /* vertex attribute pointers */
nameListTriangle[0] = GZ_POSITION;
nameListTriangle[1] = GZ_NORMAL;
nameListTriangle[2] = GZ_TEXTURE_INDEX;
nameListTriangle[3] = GZ_RGB_COLOR;
const Model::TriangleVector& triangles = water_plane_model.GetData();
for(Model::TriangleVector::const_iterator it = triangles.begin(); it != triangles.end(); it++)
{
valueListTriangle[0] = (GzPointer)(*it)->vertices;
valueListTriangle[1] = (GzPointer)(*it)->normals;
valueListTriangle[2] = (GzPointer)(*it)->uvs;
GzPutTriangle(in_renderer, 3, nameListTriangle, valueListTriangle);
}
return GZ_SUCCESS;
}