mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-10 04:31:34 -10:00
allow us to build without D3D support under Windows (just define NO_DIRECT3D) clean up TMAP flags fix a couple of minor OpenGL state change issues with spec and env map rendering make sure we build again for OS X (OGL extension functions work a little different there) render targets always need to be power-of-2 to avoid incomplete buffer issues in the code when we disable culling in opengl_3dunlit be sure that we re-enable it on exit of function re-fix screenshots add true alpha blending support (with cmdline for now since the artwork has the catch up) draw lines with float positioning, to be more accurate with resizing on non-standard resolutions don't load cubemaps from file for D3D, not sure how to do it anyway update geometry batcher code, memory fixes, dynamic stuff, basic fixage, etc.
78 lines
2.5 KiB
C++
78 lines
2.5 KiB
C++
/*
|
|
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
|
|
*
|
|
* You may not sell or otherwise commercially exploit the source or things you
|
|
* created based on the source.
|
|
*
|
|
*/
|
|
|
|
#ifndef __GRBATCH_H__
|
|
#define __GRBATCH_H__
|
|
|
|
|
|
class geometry_batcher
|
|
{
|
|
private:
|
|
int n_to_render; // the number of primitives to render
|
|
int n_allocated; // the number of verts allocated
|
|
vertex *vert;
|
|
vertex **vert_list; // V's stupid rendering functions need this
|
|
|
|
// makes sure we have enough space in the memory buffer for the geometry we are about to put into it
|
|
// you need to figure out how many verts are going to be required
|
|
void allocate_internal(int n_verts);
|
|
|
|
void clone(const geometry_batcher &geo);
|
|
|
|
public:
|
|
geometry_batcher(): n_to_render(0), n_allocated(0), vert(NULL), vert_list(NULL) {};
|
|
~geometry_batcher();
|
|
|
|
geometry_batcher(const geometry_batcher &geo) { clone(geo); }
|
|
const geometry_batcher &operator=(const geometry_batcher &geo);
|
|
|
|
// initial memory space needed
|
|
// NOTE: This MUST be called BEFORE calling any of the draw_*() functions!!
|
|
void allocate(int quad, int n_tri = 0);
|
|
|
|
// allocate an additional block of memory to what we already have (this is a resize function)
|
|
void add_allocate(int quad, int n_tri = 0);
|
|
|
|
// draw a bitmap into the geometry batcher
|
|
void draw_bitmap(vertex *position, int orient, float rad, float depth = 0);
|
|
|
|
// draw a rotated bitmap
|
|
void draw_bitmap(vertex *position, int orient, float rad, float angle, float depth);
|
|
|
|
// draw a simple 3 vert polygon
|
|
void draw_tri(vertex *verts);
|
|
|
|
// draw a simple 4 vert polygon
|
|
void draw_quad(vertex *verts);
|
|
|
|
// draw a beam
|
|
void draw_beam(vec3d *start, vec3d *end, float width, float intensity = 1.0f);
|
|
|
|
//draw a laser
|
|
float draw_laser(vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b);
|
|
|
|
// draw all of the batched geometry to the back buffer and flushes the cache
|
|
// accepts tmap flags so you can use anything you want really
|
|
void render(int flags);
|
|
|
|
// determine if we even need to try and render this (helpful for particle system)
|
|
int need_to_render() { return n_to_render; };
|
|
|
|
void operator =(int){};
|
|
};
|
|
|
|
|
|
float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float width2, int r = 255, int g = 255, int b = 255);
|
|
int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float rad, float alpha = 1.0f, float depth = 0.0f);
|
|
void batch_render_all();
|
|
void batch_render_bitmaps();
|
|
void batch_render_lasers();
|
|
void batch_reset();
|
|
|
|
#endif
|