本文整理汇总了C++中Matrix4::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::getData方法的具体用法?C++ Matrix4::getData怎么用?C++ Matrix4::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4
的用法示例。
在下文中一共展示了Matrix4::getData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Matrix4 Matrix4::operator=(Matrix4 mat4)
{
float* tmp = mat4.getData();
for(int i = 0; i < 16; i++)
mData[i] = tmp[i];
return *this;
}
示例2: renderAll
void RenderEngine::renderAll() {
ShaderTextureRenderOpMap::iterator opIter;
for(opIter = _renderOps.begin(); opIter != _renderOps.end(); ++opIter) {
_programs[opIter->first].use();
Matrix4 projection;
projection.setOrtho(-(int)_settings.getWindowWidth() / 2.0f, _settings.getWindowWidth() / 2.0f,
-(int)_settings.getWindowHeight() / 2.0f, _settings.getWindowHeight() / 2.0f, 0.0f, 100.0f);
glUniformMatrix4fv(_uniforms[opIter->first].projection, 1, GL_TRUE, projection.getData());
Matrix4 camera;
glUniformMatrix4fv(_uniforms[opIter->first].modelview, 1, GL_TRUE, camera.getData());
TextureRenderOpMap::iterator texIter;
for(texIter = opIter->second.begin(); texIter != opIter->second.end(); ++texIter) {
if(texIter->first) {
float texsize[2] = {texIter->first->getWidth() * 1.0f, texIter->first->getHeight() * 1.0f};
glUniform2fv(_uniforms[opIter->first].texsize, 1, texsize);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texIter->first->getID());
glUniform1i(_uniforms[opIter->first].texture, 0);
}
std::vector<RenderOperation*>& op = texIter->second;
for(unsigned int i = 0; i < op.size(); ++i) {
if(op[i]->getUpdateElements() && op[i]->getUpdateVertices()) {
op[i]->update();
} else if(op[i]->getUpdateElements()) {
op[i]->updateElements();
} else if(op[i]->getUpdateVertices()) {
op[i]->updateVertices();
}
glBindVertexArray(op[i]->getVAO());
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, op[i]->getIBO());
glDrawElements(GL_TRIANGLES, op[i]->getElementCount(), GL_UNSIGNED_INT, reinterpret_cast<void*>(0));
}
}
}
}