本文整理汇总了C++中vec3::data方法的典型用法代码示例。如果您正苦于以下问题:C++ vec3::data方法的具体用法?C++ vec3::data怎么用?C++ vec3::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec3
的用法示例。
在下文中一共展示了vec3::data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void CameraPathControls::draw(const mat4& projection, const mat4 views[],
const vec3& lightPositionWorld,
const int& selectedControlPoint,
float deltaT) const {
/// Common drawing.
predraw();
/// Update the model matrix.
static float angle = 1.0f;
angle += deltaT * 1.0f;
mat4 rotationMatrix = mat4::Identity();
rotationMatrix(0,0) = +std::cos(angle);
rotationMatrix(0,1) = -std::sin(angle);
rotationMatrix(1,0) = +std::sin(angle);
rotationMatrix(1,1) = +std::cos(angle);
/// Update the content of the uniforms.
glUniformMatrix4fv( _projectionID, 1, GL_FALSE, projection.data());
glUniformMatrix4fv( _viewID, 1, GL_FALSE, views[0].data());
glUniform3fv(_lightPositionWorldID, 1, lightPositionWorld.data());
glUniform1i( _selectedControlPointID, selectedControlPoint);
glUniformMatrix4fv(_rotationMatrixID, 1, GL_FALSE, rotationMatrix.data());
/// Render from camera point of view to 'normal' FBOs.
glBindFramebuffer(GL_FRAMEBUFFER, framebufferIDs["controllerView"]);
_vertices->draw();
}
示例2: setUniform
void Program::setUniform(int nLoc, uint32_t type, const vec3& value, bool forced)
{
if (nLoc == -1) return;
(void)type;
assert(type == GL_FLOAT_VEC3);
assert(loaded());
if (forced || ((_vec3Cache.count(nLoc) == 0) || (_vec3Cache[nLoc] != value)))
{
_vec3Cache[nLoc] = value;
glUniform3fv(nLoc, 1, value.data());
}
checkOpenGLError("setUniform - vec3");
}
示例3: setUniform
void Program::setUniform(int nLoc, uint32_t type, const vec3& value, bool forced)
{
#if !defined(ET_CONSOLE_APPLICATION)
if (nLoc == -1) return;
(void)type;
ET_ASSERT(type == GL_FLOAT_VEC3);
ET_ASSERT(apiHandleValid());
if (forced || ((_vec3Cache.count(nLoc) == 0) || (_vec3Cache[nLoc] != value)))
{
_vec3Cache[nLoc] = value;
glUniform3fv(nLoc, 1, value.data());
checkOpenGLError("glUniform3fv");
}
#endif
}