static void update_viewproj_matrix(struct gs_device *device) { struct gs_shader *vs = device->cur_vertex_shader; struct matrix4 cur_proj; gs_matrix_get(&device->cur_view); matrix4_copy(&cur_proj, &device->cur_proj); if (device->cur_fbo) { cur_proj.x.y = -cur_proj.x.y; cur_proj.y.y = -cur_proj.y.y; cur_proj.z.y = -cur_proj.z.y; cur_proj.t.y = -cur_proj.t.y; glFrontFace(GL_CW); } else { glFrontFace(GL_CCW); } gl_success("glFrontFace"); matrix4_mul(&device->cur_viewproj, &device->cur_view, &cur_proj); matrix4_transpose(&device->cur_viewproj, &device->cur_viewproj); if (vs->viewproj) gs_shader_set_matrix4(vs->viewproj, &device->cur_viewproj); }
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) gs_shader_set_matrix4(vs->viewproj, &device->cur_viewproj); }
static void update_viewproj_matrix(struct gs_device *device) { struct gs_shader *vs = device->cur_vertex_shader; struct matrix3 cur_matrix; gs_matrix_get(&cur_matrix); matrix4_from_matrix3(&device->cur_view, &cur_matrix); 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, vs->viewproj, &device->cur_viewproj); }
void gs_device::UpdateViewProjMatrix() { gs_matrix_get(&curViewMatrix); /* 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) gs_shader_set_matrix4(curVertexShader->viewProj, &curViewProjMatrix); }
void xcursor_render(xcursor_t *data) { struct matrix4 trans; gs_effect_t effect = gs_get_effect(); gs_eparam_t image = gs_effect_get_param_by_name(effect, "image"); gs_effect_set_texture(image, data->tex); gs_matrix_push(); gs_matrix_get(&trans); gs_matrix_identity(); gs_matrix_translate3f(data->pos_x, data->pos_y, 0.0f); gs_matrix_mul(&trans); gs_enable_blending(True); gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); gs_draw_sprite(data->tex, 0, 0, 0); gs_matrix_pop(); }