Putting it all together and testing it.
This commit is contained in:
@ -102,6 +102,8 @@ void primitiveBufferIndices(primitive_t *primitive,
|
||||
}
|
||||
|
||||
void primitiveDraw(primitive_t *primitive, int32_t start, int32_t count) {
|
||||
if(count == -1) count = primitive->indiceCount;
|
||||
|
||||
// Re-Bind the buffers
|
||||
glBindBuffer(GL_ARRAY_BUFFER, primitive->vertexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, primitive->indexBuffer);
|
||||
|
@ -42,7 +42,7 @@ void primitiveBufferIndices(primitive_t *primitive,
|
||||
* Draw a primitive. Primitives are drawn by their indices.
|
||||
* @param primitive Primitive to draw.
|
||||
* @param start Start indice (index) to draw.
|
||||
* @param count Count of indices to draw.
|
||||
* @param count Count of indices to draw. Use -1 to draw all.
|
||||
*/
|
||||
void primitiveDraw(primitive_t *primitive, int32_t start, int32_t count);
|
||||
|
||||
|
@ -22,7 +22,8 @@ void renderInit() {
|
||||
}
|
||||
|
||||
void renderFrameStart() {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Clear the frame buffer.
|
||||
frameBufferUse(NULL, true);
|
||||
}
|
||||
|
||||
void renderDispose() {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "framebuffer.h"
|
||||
|
||||
/**
|
||||
* Initialize the renderer.
|
||||
|
@ -46,6 +46,18 @@ void shaderUseCamera(shader_t *shader, camera_t *camera);
|
||||
*/
|
||||
void shaderUseTexture(shader_t *shader, texture_t *texture);
|
||||
|
||||
/**
|
||||
* Set's the current translation matrix onto the shader for the next
|
||||
* render to use.
|
||||
*
|
||||
* @param shader Shader to attach to.
|
||||
* @param x X coordinate (world space).
|
||||
* @param y Y coordinate (world space).
|
||||
* @param z Z coordinate (world space).
|
||||
* @param pitch Pitch of the object (local space).
|
||||
* @param yaw Yaw of the object (local space).
|
||||
* @param roll Roll of the object (local space).
|
||||
*/
|
||||
void shaderUsePosition(shader_t *shader,
|
||||
float x, float y, float z,
|
||||
float pitch, float yaw, float roll
|
||||
|
@ -46,15 +46,17 @@ tileset_t * tilesetCreate(
|
||||
borderX + (tileset->divX * x) + (gapX * x)
|
||||
) / width;
|
||||
tileset->divisions[i].x1 = tileset->divisions[i].x0 + tdivX;
|
||||
|
||||
// tileset->divisions[i].y0 = (borderY + (divY * y) + (gapY * y)) / height;
|
||||
// tileset->divisions[i].y1 = tileset->divisions[i].y0 + tdivY;
|
||||
|
||||
// Vertically flipped for OpenGL
|
||||
tileset->divisions[i].y1 = (
|
||||
|
||||
tileset->divisions[i].y0 = (
|
||||
borderY + (tileset->divY * y) + (gapY * y)
|
||||
) / height;
|
||||
tileset->divisions[i].y0 = tileset->divisions[i].y1 + tdivY;
|
||||
tileset->divisions[i].y1 = tileset->divisions[i].y0 + tdivY;
|
||||
|
||||
// Vertically flipped if necessary
|
||||
// tileset->divisions[i].y1 = (
|
||||
// borderY + (tileset->divY * y) + (gapY * y)
|
||||
// ) / height;
|
||||
// tileset->divisions[i].y0 = tileset->divisions[i].y1 + tdivY;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user