void STKAnimatedMesh::uploadJoints(const irr::core::matrix4& m,
                                   int joint, int offset)
{
    assert(offset != -1);
    glBindBuffer(GL_UNIFORM_BUFFER, SharedGPUObjects::getSkinningUBO());
    glBufferSubData(GL_UNIFORM_BUFFER, offset + joint * 16 * sizeof(float),
        16 * sizeof(float), m.pointer());
}
void btTransformFromIrrlichtMatrix(const irr::core::matrix4& irrmat, btTransform &transform)
{
    transform.setIdentity();

    /*btScalar mat[16];

    for(irr::u32 i=0; i < 16; i++)
    {
        mat[i] = irrmat.pointer()[i];
    }*/

    transform.setFromOpenGLMatrix(irrmat.pointer());
    //transform.setFromOpenGLMatrix(mat);
}
Exemple #3
0
void RainNode::simulate() {
	glUseProgram(SimulationProgram);
	const float time = irr_driver->getDevice()->getTimer()->getTime() / 90.0f;
	const irr::core::matrix4 viewm = irr_driver->getVideoDriver()->getTransform(irr::video::ETS_VIEW);
	const irr::core::vector3df campos = irr_driver->getSceneManager()->getActiveCamera()->getPosition();

	glEnable(GL_RASTERIZER_DISCARD);
	glEnableVertexAttribArray(0);
	glBindBuffer(GL_ARRAY_BUFFER, tfb_vertex_buffer[0]);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
	glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfb_vertex_buffer[1]);

	glUniformMatrix4fv(loc_viewm, 1, GL_FALSE, viewm.pointer());
	glUniform1f(loc_time, time);
	glUniform3f(loc_campos, campos.X, campos.Y, campos.Z);
	glBeginTransformFeedback(GL_POINTS);
	glDrawArrays(GL_POINTS, 0, count);
	glEndTransformFeedback();
	glDisable(GL_RASTERIZER_DISCARD);
}
Exemple #4
0
void btTransformFromIrrlichtMatrix(const irr::core::matrix4& irrmat, btTransform &transform)
{
    transform.setIdentity();

    transform.setFromOpenGLMatrix(irrmat.pointer());
}
Exemple #5
0
void btTransformToIrrlichtMatrix(const btTransform& worldTrans, irr::core::matrix4 &matr)
{
    worldTrans.getOpenGLMatrix(matr.pointer());
}
 static void setUniformsHelper(const std::vector<GLuint> &uniforms, const irr::core::matrix4 &mat, Args... arg)
 {
     glUniformMatrix4fv(uniforms[N], 1, GL_FALSE, mat.pointer());
     setUniformsHelper<N + 1>(uniforms, arg...);
 }