本文整理汇总了C++中Matrix4x4::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::GetData方法的具体用法?C++ Matrix4x4::GetData怎么用?C++ Matrix4x4::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4::GetData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Renderer::Render(const Camera& cam, IContext& c){
#if ZEUS_SAFE
if (c.GetType() != IContext::OpenGL21) throw Exception("Context not supported by renderer: " + Utils::ToString<IContext::Type>(c.GetType()));
#endif
Context& glContext = (Context&)c;
// Draw scene
ApplyCamera(cam, c);
glEnable(GL_CULL_FACE);
// @TODO Setup light. Lightmaps 'n shit
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
Vector3 dir = Vector3(1,3,2);
Normalize(dir);
float hat[4]; dir.GetData(hat); hat[3] = 1.0f;
glLightfv(GL_LIGHT0, GL_POSITION, hat);
SceneObjectList::iterator itr = SceneObjectList::Begin();
while (itr != SceneObjectList::End()){
//Debug::Log("Rendering " + (*itr)->GetName());
const ModelComponent* m = (*itr)->GetComponent<ModelComponent>();
if (m){
//Debug::Log((*itr)->GetName() + " has mesh");
const ModelPropertiesPtr props = m->GetModelProperties();
if (props) {
ModelProperties::Texture2DIterator itr = props->Texture2DBegin();
while (itr != props->Texture2DEnd()) {
const GLTexture2D* tex = glContext.AddTexture(itr->second);
glBindTexture(GL_TEXTURE_2D, tex->GetID());
glEnable(GL_TEXTURE_2D);
++itr;
}
} else {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
}
const MeshPtr mesh = m->GetMesh();
if (mesh) {
const Transformation* t = (*itr)->GetComponent<Transformation>();
glPushMatrix();
Matrix4x4 m = t->GetAccumulatedMatrix();
glMultMatrixf(m.GetData());
// @TODO Apply material
const GLMesh* mInfo = glContext.AddMesh(mesh);
RenderModel(*mInfo, glContext);
glPopMatrix();
}
}
++itr;
}
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
glDisable(GL_CULL_FACE);
}