void PPropertyTransform::setValue(const PVariant &value) { PASSERT(value.getType() == P_VARIANT_MATRIX4X4); if (value.getType() == P_VARIANT_MATRIX4X4) { setMatrix4x4(value.toMatrix4x4().m_m); } }
/** Populates the initial values of the uniform, based on the size and type. */ void CC3GLSLUniform::populateInitialValue() { for (GLint vIdx = 0 ; vIdx < _size; vIdx++) { CC3Matrix3x3 m3x3; CC3Matrix4x4 m4x4; switch (_type) { case GL_FLOAT: case GL_FLOAT_VEC2: case GL_FLOAT_VEC3: case GL_FLOAT_VEC4: setVector4( CC3Vector4(0.0f, 0.0f, 0.0f, 1.0f), vIdx ); return; case GL_FLOAT_MAT2: setVector4( CC3Vector4(1.0f, 0.0f, 0.0f, 1.0f), vIdx ); return; case GL_FLOAT_MAT3: CC3Matrix3x3PopulateIdentity(&m3x3); setMatrix3x3( &m3x3, vIdx ); return; case GL_FLOAT_MAT4: CC3Matrix4x4PopulateIdentity(&m4x4); setMatrix4x4( &m4x4, vIdx ); return; case GL_INT: case GL_INT_VEC2: case GL_INT_VEC3: case GL_INT_VEC4: case GL_SAMPLER_2D: case GL_SAMPLER_CUBE: case GL_BOOL: case GL_BOOL_VEC2: case GL_BOOL_VEC3: case GL_BOOL_VEC4: setIntVector4( CC3IntVector4Make(0, 0, 0, 1), vIdx ); return; default: CCAssert(false, "CC3GLSLUniform could not set value because type %s is not understood"/*, stringFromGLEnum(_type).c_str()*/); return; } } }
void CC3GLSLUniform::setMatrix4x4( const CC3Matrix4x4* value ) { setMatrix4x4( value, 0 ); }
void PPropertyTransform::operator=(const PMatrix4x4 &matrix) { setMatrix4x4(matrix.m_m); }