本文整理汇总了C++中TransformComponent::getMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::getMatrix方法的具体用法?C++ TransformComponent::getMatrix怎么用?C++ TransformComponent::getMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::getMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unitDraw
void SkeletalMeshGraphicComponent::unitDraw(RenderParameter ¶m)//Actor *actor,Engine::Scene* scene)
{
glDebug();
TransformComponent* trans = 0;
if(m_pOwner)trans = m_pOwner->getComponent<TransformComponent>(ComponentId::Transform);
//glPushMatrix();
glColor3f(0, 1, 0);
Shader* currentShader = 0;
if(param.flag & RenderFlag::Default)currentShader = shader;
else if(param.flag & RenderFlag::Shadow)currentShader = shader_shadow;
if(currentShader) {
currentShader->Use();
glDebug();
GLuint p = currentShader->getProgramId();
int loc;
glDebug();
if(trans) {
loc=currentShader->getUniformLocation("MVM");
if(loc>=0)glUniformMatrix4fv(loc, 1, 0, &trans->getMatrix()[0][0]);
}
glDebug(param.flag);
loc=currentShader->getUniformLocation("textureMatrix");
if(param.flag & RenderFlag::Default)if(loc>-1)glUniformMatrix2fv(loc, 1, 0, &textureMatrix[0][0]);
glDebug(param.flag);
mesh->updateUniform(currentShader->getProgramId());
mesh->draw(materials, currentShader,param.flag);
glDebug();
}
//glPopMatrix();
}
示例2: initModels
void initModels()
{
EntitySystem::Init();
rot = 0;
if (render1Enabled) {
float x_pos = 0, y_pos = 0, z_pos = 0;
Entity* e = EntitySystem::CreateEntity();
TransformComponent* transform = TransformSystem::CreateComponent()
->translate(x_pos, y_pos, z_pos)
->rotate(0, 0, 0)
->uniform_scale(0.1f);
e->add_component(transform);
render_model1 = graphics::RenderOperationManager::GetDrawModelOp(render_1_model);
render_model1->ModelMatrix = transform->getMatrix();
render_model1->_material->
_primary_color(graphics::Color4f(1, 0, 0, 1))->
_is_lit(false)->
_diffuse_texture(graphics::TextureManager::GetTexture("resources/enemy_text02.bmp"));
}
if (render2Enabled) {
float x_pos = 0, y_pos = 0, z_pos = 0, line_thickness = 1;
int rows = 20, cols = 20, spacing = 20;
graphics::Color4f color(.5,.5, .5, 1);
render_model2 = new graphics::RenderOperation();
render_model2->Operation_Type = graphics::RenderOperation::DRAW_MODEL;
render_model2->_material
->_is_lit(false)
->_is_colored(true);
render_model2->VertexBuffer = graphics::VertexBufferManager::GetBuffer(USE_COLOR | USE_TEXTURE | USE_NORMAL, (rows + cols + 2) * 8, (rows + cols + 2) * 36);
graphics::Primitives::CreateGrid(render_model2->VertexBuffer, rows, cols, spacing, spacing, line_thickness, &color);
graphics::Transform transform;
transform.translate(x_pos, y_pos, z_pos);
render_model2->ModelMatrix = transform.getMatrix();
}
//terrain.CreateGrid(128, 128, 500);
}