//Graphics uint32_t current_count = 1; TripleGPUBuffer* v_buffer = OpenGLEmu::GetBufferAtBinding(0); uint32_t bi = OpenGLEmu::ogs.current_buffer_index; for(int i = 0;i < 32;++i) { //Physics PxVec3 lv = GamePieceCode::game_pieces[i].rbd.state->getLinearVelocity(); lv *= ground_friction; GamePieceCode::game_pieces[i].rbd.state->setLinearVelocity(lv); //Graphics OpenGLEmu::UseProgram(GamePieceCode::game_pieces[i].program); float2 uvs[4]; uvs[0] = float2(0.0f,0.0f); uvs[1] = float2(1.0f,0.0f); uvs[2] = float2(1.0f,1.0f); uvs[3] = float2(0.0f,1.0f); float matrix[16] = {1,0,0,0, 0,1,0,0 ,0,0,1,0, 0,0,0,1}; float4 temp_color = float4(1); PxTransform pxt = GamePieceCode::game_pieces[i].rbd.state->getGlobalPose(); GamePieceCode::game_pieces[i].ot.p = float3(pxt.p.x,pxt.p.y,pxt.p.z); SpriteBatchCode::AddSpriteToBatchAtBuffer(OpenGLEmu::ogs.current_buffer_index, GamePieceCode::game_pieces[i].ot.p, GamePieceCode::game_pieces[i].ot.r, GamePieceCode::game_pieces[i].ot.s.xy(), float4(1) ,uvs,matrix, v_buffer); current_count++; } SpriteUniforms* uniforms = SetUniformsVertex(SpriteUniforms); uniforms->pcm_mat = ortho_cam.projection_matrix;//float4x4::identity();//Camera::main.projection_matrix; OpenGLEmu::AddFragTextureBinding(GamePieceCode::game_pieces[0].texture,0); float from_bytes = v_buffer->from_to_bytes.y(); float to_bytes = from_bytes + current_count * SIZE_OF_SPRITE_IN_BYTES; v_buffer->from_to_bytes = float2(from_bytes,to_bytes); OpenGLEmu::AddBufferBinding(0,0,v_buffer->from_to_bytes.x()); OpenGLEmu::DrawArrays(current_count * 6,SIZE_OF_SPRITE_IN_BYTES); current_count = 1; v_buffer = OpenGLEmu::GetBufferAtBinding(0); bi = OpenGLEmu::ogs.current_buffer_index; for(int i = 0;i < 32;++i) { //Graphics OpenGLEmu::UseProgram(GamePieceCode::game_pieces[i].program); float2 uvs[4]; uvs[0] = float2(0.0f,0.0f); uvs[1] = float2(1.0f,0.0f); uvs[2] = float2(1.0f,1.0f); uvs[3] = float2(0.0f,1.0f); float matrix[16] = {1,0,0,0, 0,1,0,0 ,0,0,1,0, 0,0,0,1}; float4 temp_color = float4(1); //GamePieceCode::game_pieces[i].ot.p = float3(pxt.p.x,pxt.p.y,pxt.p.z); SpriteBatchCode::AddSpriteToBatchAtBuffer(OpenGLEmu::ogs.current_buffer_index, GamePieceCode::game_pieces[i].ot.p, GamePieceCode::game_pieces[i].ot.r, GamePieceCode::game_pieces[i].life_ot[0].s.xy(), float4(1) ,uvs,matrix, v_buffer); current_count++; } SpriteUniforms* uuniforms = SetUniformsVertex(SpriteUniforms); uuniforms->pcm_mat = ortho_cam.projection_matrix; OpenGLEmu::AddFragTextureBinding(GamePieceCode::game_pieces[0].life_bar_texture,0); from_bytes = v_buffer->from_to_bytes.y(); to_bytes = from_bytes + current_count * SIZE_OF_SPRITE_IN_BYTES; v_buffer->from_to_bytes = float2(from_bytes,to_bytes); OpenGLEmu::AddBufferBinding(0,0,v_buffer->from_to_bytes.x()); OpenGLEmu::DrawArrays(current_count * 6,SIZE_OF_SPRITE_IN_BYTES); PhysicsCode::Update(&scene,1,0.016f);