Exemplo n.º 1
0
static matrix4x4_t GetWorldToViewMatrix() {
	void ML_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg, qboolean zup);
	matrix4x4_t worldToViewMatrixT, worldToViewMatrix;
	ML_ModelViewMatrix( &worldToViewMatrixT.m[0][0], r_refdef.viewangles, r_refdef.vieworg, true);
	// ML is OGL matrix style, here something sane is needed
	Matrix4x4_Transpose( &worldToViewMatrix, &worldToViewMatrixT );
	return worldToViewMatrix;
}
Exemplo n.º 2
0
static matrix4x4_t GetWorldToLightMatrix( const R_ShaderLight *light ) {
	void ML_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg, qboolean zup);
	matrix4x4_t worldToLightMatrixT, worldToLightMatrix;
	ML_ModelViewMatrix( &worldToLightMatrixT.m[0][0], light->angles, light->origin, false);
	// ML is OGL matrix style, here something sane is needed
	Matrix4x4_Transpose( &worldToLightMatrix, &worldToLightMatrixT );
	return worldToLightMatrix;
}
Exemplo n.º 3
0
/**
 * @brief
 */
void R_MatricesChanged_default(void) {

	r_default_program_t *p = &r_default_program;

	if (r_state.active_program->matrix_dirty[R_MATRIX_MODELVIEW]) {
		// recalculate normal matrix if the modelview has changed.
		static matrix4x4_t normalMatrix;

		R_GetMatrix(R_MATRIX_MODELVIEW, &normalMatrix);
		Matrix4x4_Invert_Full(&normalMatrix, &normalMatrix);
		Matrix4x4_Transpose(&normalMatrix, &normalMatrix);
		R_ProgramParameterMatrix4fv(&p->normal_mat, (const GLfloat *) normalMatrix.m);
	}
}