예제 #1
0
static void update_viewproj_matrix(struct gs_device *device)
{
	struct gs_shader *vs = device->cur_vertex_shader;
	gs_matrix_get(&device->cur_view);

	matrix4_mul(&device->cur_viewproj, &device->cur_view,
			&device->cur_proj);
	matrix4_transpose(&device->cur_viewproj, &device->cur_viewproj);

	if (vs->viewproj)
		shader_setmatrix4(vs->viewproj, &device->cur_viewproj);
}
예제 #2
0
void gs_device::UpdateViewProjMatrix()
{
	matrix3 cur_matrix;
	gs_matrix_get(&cur_matrix);

	matrix4_from_matrix3(&curViewMatrix, &cur_matrix);

	/* negate Z col of the view matrix for right-handed coordinate system */
	curViewMatrix.x.z = -curViewMatrix.x.z;
	curViewMatrix.y.z = -curViewMatrix.y.z;
	curViewMatrix.z.z = -curViewMatrix.z.z;
	curViewMatrix.t.z = -curViewMatrix.t.z;

	matrix4_mul(&curViewProjMatrix, &curViewMatrix, &curProjMatrix);
	matrix4_transpose(&curViewProjMatrix, &curViewProjMatrix);

	if (curVertexShader->viewProj)
		shader_setmatrix4(curVertexShader, curVertexShader->viewProj,
				&curViewProjMatrix);
}