#pragma once #include "gl_batch.h" #include "../util/matrix.h" // magic number sue me. yes this float is representable exactly. const F32 SCREEN_INVALID_POS = -2137000.f; struct VERTEX3D { VEC3 pos; VEC2 uv; CLR clr; U8 sampler; }; using GL_BATCH3D = GL_BATCH; struct GL_3D : GL_SHADER_PROGRAM { F32 aspect; MAT4 projmat; VEC2 winsize; }; // shader init ----------------------------------------------------------- extern GL_3D* gl_3d_init( GL_DATA* gl, VEC2 screensize, const char* shadername ); // sets up projection matrix and sends it to the gpu ------------------------------------------------------------ extern void gl_3d_projection_setup( GL_SHADER_PROGRAM* gl3d, VEC3 pos, F32 fov_deg, F32 yaw, F32 pitch, F32 near, F32 far, VEC2 winsize ); extern void gl_3d_batch_setup( GL_BATCH3D* batch ); // takes a triangle fan not set of triangles extern void gl_3d_polygon( GL_SHADER_PROGRAM* gl3d, VERTEX3D* vertices, U32 vertices_count, GL_TEX2D* tex ); // calculates triangle set from triangle fan before sending to batch extern void gl_3d_polygon_fan( GL_BATCH3D* batch, VERTEX3D* vertices, U32 vertices_count, GL_TEX2D* tex ); // draws a set of triangles extern void gl_3d_polygon( GL_BATCH3D* batch, VERTEX3D* vertices, U32 vertices_count, GL_TEX2D* tex ); extern void gl_3d_plane( GL_SHADER_PROGRAM* gl3d, VEC3 pos, VEC2 size, VEC2 rot, GL_TEX2D* tex, CLR col = CLR::WHITE() ); extern void gl_3d_plane( GL_BATCH3D* batch, VEC3 pos, VEC2 size, VEC2 rot, GL_TEX2D* tex, CLR col = CLR::WHITE() );