Esempio n. 1
0
void DX11DeferredRendererMaterial::SetMatrix(const Affine3f& world, const Matrix4f& view_projection){

	auto& buffer = *shader_parameters_->Lock<ShaderParameters>();

	// Update

	buffer.world = world.matrix();
	buffer.world_view_proj = (view_projection * world).matrix();

	shader_parameters_->Unlock();
	
}
Esempio n. 2
0
void on_draw_frame() {
    //glClearColor(0.30f, 0.74f, 0.20f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    // Set the blending function (normal w/ premultiplied alpha)
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    update_life_cycle();
    // Create Projection Matrix
    float aspectRatio = 768.0f / 1022;
    Affine3f m;
    m = Scaling(1.0f, aspectRatio, 1.0f);
    Matrix4f projectionMatrix = Matrix4f::Identity();
    projectionMatrix = m.matrix();
    // Render Emitter
    if (s_emitters.size() > 0) {
      std::vector<EmitterObject*>::iterator it = s_emitters.begin();
      for (; it != s_emitters.end(); ++it) {
        (*it)->RenderWithProjection(projectionMatrix);
      }
    }
/*
 
    glUseProgram(program);
 
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);
    glUniform1i(u_texture_unit_location, 0);
 
    glBindBuffer(GL_ARRAY_BUFFER, buffer);
    glVertexAttribPointer(a_position_location, 2, GL_FLOAT, GL_FALSE, 
        4 * sizeof(GL_FLOAT), BUFFER_OFFSET(0));
    glVertexAttribPointer(a_texture_coordinates_location, 2, GL_FLOAT, GL_FALSE, 
        4 * sizeof(GL_FLOAT), BUFFER_OFFSET(2 * sizeof(GL_FLOAT)));
    glEnableVertexAttribArray(a_position_location);
    glEnableVertexAttribArray(a_texture_coordinates_location);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
    glBindBuffer(GL_ARRAY_BUFFER, 0);
*/
}
Esempio n. 3
0
Matrix4f Camera::getViewMatrix() const {
    Affine3f view;
    view.setIdentity();
    view.translate(-zoom*Z_AXIS).rotate(rotation).translate(-center);
    return view.matrix();
}