added enable/disable vsync
This commit is contained in:
@@ -30,10 +30,13 @@ public:
|
||||
~Renderer();
|
||||
|
||||
framebuffer_t frameBuffers[2];
|
||||
u8 context;
|
||||
u8 context; // TODO
|
||||
zbuffer_t zBuffer;
|
||||
prim_t prim;
|
||||
|
||||
void enableVSync() { isVSyncEnabled = true; }
|
||||
void disableVSync() { isVSyncEnabled = false; }
|
||||
|
||||
/** PATH3 Many + lighting */
|
||||
void drawByPath3(Mesh *t_meshes, u16 t_amount, LightBulb *t_bulbs, u16 t_bulbsCount);
|
||||
/** PATH3 Single + lighting */
|
||||
@@ -62,7 +65,7 @@ private:
|
||||
void changeTexture(const Mesh &t_mesh, u32 t_materialId);
|
||||
u32 lastTextureId;
|
||||
texbuffer_t textureBuffer;
|
||||
u8 isTextureVRAMAllocated;
|
||||
u8 isTextureVRAMAllocated, isVSyncEnabled;
|
||||
void allocateTextureBuffer(u16 t_width, u16 t_height);
|
||||
void deallocateTextureBuffer();
|
||||
void flipBuffers();
|
||||
|
||||
@@ -183,8 +183,6 @@ void Mesh::animate()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO think about that, because in Ari sample it eats 88 FPS :O
|
||||
|
||||
u32 Mesh::getDrawData(u32 t_materialIndex, VECTOR *o_vertices, VECTOR *o_normals, VECTOR *o_coordinates, Vector3 &t_cameraPos)
|
||||
{
|
||||
VECTOR ONE_VEC = {1.0F, 1.0F, 1.0F, 1.0F};
|
||||
|
||||
@@ -37,6 +37,7 @@ Renderer::Renderer(u32 t_packetSize, ScreenSettings *t_screen)
|
||||
dma_channel_fast_waits(DMA_CHANNEL_GIF);
|
||||
context = 0;
|
||||
isTextureVRAMAllocated = false;
|
||||
isVSyncEnabled = true;
|
||||
isFrameEmpty = false;
|
||||
lastTextureId = 0;
|
||||
flipPacket = packet_init(3, PACKET_UCAB); // Uncached accelerated
|
||||
@@ -264,7 +265,7 @@ void Renderer::endFrame(float fps)
|
||||
{
|
||||
if (!isFrameEmpty)
|
||||
{
|
||||
if (fps > 49.0F)
|
||||
if (fps > 49.0F && isVSyncEnabled)
|
||||
graph_wait_vsync();
|
||||
flipBuffers();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user