本文整理汇总了C++中Geometry::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::Render方法的具体用法?C++ Geometry::Render怎么用?C++ Geometry::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::Render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderElement
// Called to render the decorator on an element.
void DecoratorTiledImage::RenderElement(Element* element, DecoratorDataHandle element_data)
{
Geometry* data = reinterpret_cast< Geometry* >(element_data);
data->Render(element->GetAbsoluteOffset(Box::PADDING));
}
示例2: Render
void Implicit::Render()
{
// Draw bounding box for debugging
Bbox b = GetBoundingBox();
Vector3<float> & v0 = b.pMin;
Vector3<float> & v1 = b.pMax;
if(mSelected) {
glLineWidth(2.0f);
glColor3f(0.8f,0.8f,0.8f);
}
else glColor3f(0.1f,0.1f,0.1f);
glBegin(GL_LINE_STRIP);
glVertex3f(v0[0], v0[1], v0[2]);
glVertex3f(v1[0], v0[1], v0[2]);
glVertex3f(v1[0], v1[1], v0[2]);
glVertex3f(v0[0], v1[1], v0[2]);
glVertex3f(v0[0], v0[1], v0[2]);
glEnd();
glBegin(GL_LINE_STRIP);
glVertex3f(v0[0], v0[1], v1[2]);
glVertex3f(v1[0], v0[1], v1[2]);
glVertex3f(v1[0], v1[1], v1[2]);
glVertex3f(v0[0], v1[1], v1[2]);
glVertex3f(v0[0], v0[1], v1[2]);
glEnd();
glBegin(GL_LINES);
glVertex3f(v0[0], v0[1], v0[2]);
glVertex3f(v0[0], v0[1], v1[2]);
glVertex3f(v1[0], v0[1], v0[2]);
glVertex3f(v1[0], v0[1], v1[2]);
glVertex3f(v0[0], v1[1], v0[2]);
glVertex3f(v0[0], v1[1], v1[2]);
glVertex3f(v1[0], v1[1], v0[2]);
glVertex3f(v1[0], v1[1], v1[2]);
glEnd();
glLineWidth(1.0f);
glPushMatrix();
glMultMatrixf(mTransform.ToGLMatrix().GetArrayPtr());
Geometry * mesh = dynamic_cast<Geometry *>(mMesh);
if (mesh == NULL)
std::cerr << "Error: implicit geometry not triangulated, add call to triangulate()" << std::endl;
else {
mesh->SetShowNormals(mShowNormals);
mesh->SetWireframe(mWireframe);
mesh->SetOpacity(mOpacity);
mesh->Render();
}
if (mVisualizationMode == Gradients) {
if(typeid(*mMesh) == typeid(SimpleMesh)){
SimpleMesh * ptr = static_cast<SimpleMesh*>(mMesh);
const std::vector<SimpleMesh::Vertex>& verts = ptr->GetVerts();
glDisable(GL_LIGHTING);
Matrix4x4<float> M = GetTransform().Transpose();
glColor3f(0, 0, 1);
glBegin(GL_LINES);
for(unsigned int i=0; i < verts.size(); i++){
const Vector3<float> vObject = verts.at(i).pos;
// Transform vertex position to world space
Vector4<float> vWorld = GetTransform() * Vector4<float>(vObject[0],vObject[1],vObject[2],1);
// Get gradient in world space
Vector3<float> nWorld = GetGradient(vWorld[0], vWorld[1], vWorld[2]);
// Transform gradient to object space
Vector4<float> nObject = M * Vector4<float>(nWorld[0],nWorld[1],nWorld[2],0);
Vector3<float> n = Vector3<float>(nObject[0], nObject[1], nObject[2]);
glVertex3fv(vObject.GetArrayPtr());
glVertex3fv((vObject + n*0.1).GetArrayPtr());
}
glEnd();
}
else {
std::cerr << "No Gradient visualization mode implemented for mesh type: " << typeid(*mMesh).name() << std::endl;
}
}
glPopMatrix();
GLObject::Render();
}