forked from mirrors/principia
Move some static global variables that cause collisions into static class members
This commit is contained in:
parent
e1ceb49cd2
commit
df00758dfe
31 changed files with 266 additions and 126 deletions
10
src/cable.cc
10
src/cable.cc
|
|
@ -27,11 +27,11 @@ struct cable_vert {
|
|||
|
||||
bool cable::initialized = false;
|
||||
|
||||
static struct tms_mesh *_mesh;
|
||||
static struct tms_entity *_e;
|
||||
static tms::varray *va = 0;
|
||||
static tms::gbuffer *buf = 0;
|
||||
static tms::gbuffer *ibuf = 0;
|
||||
tms_mesh *cable::_mesh;
|
||||
tms_entity *cable::_e;
|
||||
tms::varray *cable::va = 0;
|
||||
tms::gbuffer *cable::buf = 0;
|
||||
tms::gbuffer *cable::ibuf = 0;
|
||||
|
||||
static volatile int plug_counter[3] = {0,0,0};
|
||||
static struct tms_mesh *plug_mesh[3];
|
||||
|
|
|
|||
16
src/cable.hh
16
src/cable.hh
|
|
@ -1,5 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "entity.hh"
|
||||
#include "tms/bindings/cpp/cpp.hh"
|
||||
#include <set>
|
||||
|
||||
#define CABLE_BLACK 0
|
||||
#define CABLE_RED 1
|
||||
#define CABLE_BLUE 2
|
||||
|
|
@ -19,9 +23,6 @@
|
|||
|
||||
#define CABLE_MAX_EXTRA_LENGTH 5.f
|
||||
|
||||
#include "entity.hh"
|
||||
#include <set>
|
||||
|
||||
class ifdevice;
|
||||
class edevice;
|
||||
class isocket;
|
||||
|
|
@ -111,9 +112,16 @@ class cable : public entity
|
|||
static struct tms_entity *get_entity(void);
|
||||
static void reset_counter(void);
|
||||
static void upload_buffers(void);
|
||||
static bool initialized;
|
||||
static void _init(void);
|
||||
|
||||
private:
|
||||
static bool initialized;
|
||||
static tms_mesh *_mesh;
|
||||
static tms_entity *_e;
|
||||
static tms::varray *va;
|
||||
static tms::gbuffer *buf;
|
||||
static tms::gbuffer *ibuf;
|
||||
|
||||
friend class plug;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -320,6 +320,13 @@ class chunk_window : public tms::entity
|
|||
|
||||
void recreate_caveview_texture(float px, float py, float ax, float ay);
|
||||
|
||||
static bool initialized;
|
||||
static void _init();
|
||||
|
||||
private:
|
||||
static bool initialized;
|
||||
|
||||
static tms_mesh *mesh_pool[MAX_CHUNKS];
|
||||
static tms::gbuffer *vbuf[MAX_CHUNKS];
|
||||
static tms_varray *va[MAX_CHUNKS];
|
||||
static tms::gbuffer *ibuf;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@
|
|||
#include "noise.h"
|
||||
#include "misc.hh"
|
||||
|
||||
static struct tms_mesh *mesh_pool[MAX_CHUNKS];
|
||||
static tms::gbuffer *vbuf[MAX_CHUNKS];
|
||||
static struct tms_varray *va[MAX_CHUNKS];
|
||||
static struct tms_gbuffer *ibuf;
|
||||
bool chunk_window::initialized = false;
|
||||
|
||||
tms_mesh *chunk_window::mesh_pool[MAX_CHUNKS];
|
||||
tms::gbuffer *chunk_window::vbuf[MAX_CHUNKS];
|
||||
tms_varray *chunk_window::va[MAX_CHUNKS];
|
||||
tms::gbuffer *chunk_window::ibuf;
|
||||
|
||||
static struct tms_mesh *grass_pool[MAX_CHUNKS];
|
||||
static struct tms_gbuffer *grass_vbuf[MAX_CHUNKS];
|
||||
static struct tms_varray *grass_va[MAX_CHUNKS];
|
||||
|
|
@ -45,7 +46,7 @@ void chunk_window::_init() {
|
|||
ibuf->usage = GL_STATIC_DRAW;
|
||||
ibuf->target = GL_ELEMENT_ARRAY_BUFFER;
|
||||
|
||||
uint16_t *i = (uint16_t*)tms_gbuffer_get_buffer(ibuf);
|
||||
uint16_t *i = (uint16_t*)ibuf->get_buffer();
|
||||
uint16_t *ri = (uint16_t*)((char*)tms_gbuffer_get_buffer(mm->indices)+mm->i_start*2);
|
||||
uint16_t ibase = mm->v_start / sizeof(struct cvert);
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ void chunk_window::_init() {
|
|||
}
|
||||
}
|
||||
|
||||
tms_gbuffer_upload(ibuf);
|
||||
ibuf->upload();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
#define RSIZE .08f
|
||||
#define SIZE (RSIZE+.02f)
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *_va;
|
||||
static tms::mesh *_mesh;
|
||||
static tms::entity *_e;
|
||||
tms::mesh *display::_mesh;
|
||||
tms::entity *display::_e;
|
||||
tms::gbuffer *display::verts;
|
||||
tms::gbuffer *display::indices;
|
||||
tms::varray *display::_va;
|
||||
|
||||
static int n = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,13 @@ class display : public brcomp_multiconnect
|
|||
int num_symbols;
|
||||
int active_symbol;
|
||||
bool active;
|
||||
|
||||
private:
|
||||
static tms::mesh *_mesh;
|
||||
static tms::entity *_e;
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *_va;
|
||||
};
|
||||
|
||||
class passive_display : public display
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
#include "fluidbuffer.hh"
|
||||
#include "world.hh"
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::mesh *mesh;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
tms::gbuffer *fluidbuffer::verts;
|
||||
tms::gbuffer *fluidbuffer::indices;
|
||||
tms::varray *fluidbuffer::va;
|
||||
tms::mesh *fluidbuffer::mesh;
|
||||
tms::entity *fluidbuffer::e;
|
||||
tms::entity *fluidbuffer::e2;
|
||||
|
||||
static uint32_t n = 0;
|
||||
uint32_t fluidbuffer::n = 0;
|
||||
|
||||
struct fluidbuf_vert {
|
||||
tvec3 pos;
|
||||
tvec3 uv;
|
||||
};
|
||||
|
||||
static fluidbuf_vert base[4];
|
||||
fluidbuf_vert fluidbuffer::base[4];
|
||||
|
||||
void fluidbuffer::reset()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,4 +14,15 @@ class fluidbuffer
|
|||
//static void add(float x, float y, float z, float r, float g, float b, float a, float w, float h);
|
||||
static void add(float x, float y, float z, float pressure, float w, float h);
|
||||
static tms::entity *get_entity();
|
||||
|
||||
private:
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::mesh *mesh;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
|
||||
static uint32_t n;
|
||||
static struct fluidbuf_vert base[4];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#define MAX_MSLOTS 32
|
||||
|
||||
static struct tms_varray *va;
|
||||
static struct tms_gbuffer *vbuf;
|
||||
static struct tms_gbuffer *ibuf;
|
||||
bool gearbox::initialized = false;
|
||||
tms_varray *gearbox::va;
|
||||
tms_gbuffer *gearbox::vbuf;
|
||||
tms_gbuffer *gearbox::ibuf;
|
||||
|
||||
static gearbox *mslots[MAX_MSLOTS];
|
||||
static int num_mslots;
|
||||
|
|
@ -43,8 +43,8 @@ void gearbox::_init()
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
static void
|
||||
addmesh(struct tms_mesh *from, float dx, float dy, int *num_v, int *num_i)
|
||||
void
|
||||
gearbox::addmesh(struct tms_mesh *from, float dx, float dy, int *num_v, int *num_i)
|
||||
{
|
||||
gb_vert *v = (gb_vert *)(from->vertex_array->gbufs[0].gbuf->buf+from->v_start);
|
||||
uint16_t *i = (uint16_t*)(from->indices->buf+from->i_start*sizeof(uint16_t));
|
||||
|
|
@ -72,8 +72,8 @@ addmesh(struct tms_mesh *from, float dx, float dy, int *num_v, int *num_i)
|
|||
(*num_i) += from->i_count;
|
||||
}
|
||||
|
||||
static void
|
||||
recreate_meshes()
|
||||
void
|
||||
gearbox::recreate_meshes()
|
||||
{
|
||||
//tms_infof("recreate meshes- ------------------------------------------------------");
|
||||
vp = 0;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ class gearbox : public edev, public b2QueryCallback
|
|||
|
||||
void create_gearjoint();
|
||||
|
||||
static bool initialized;
|
||||
static void _init();
|
||||
|
||||
private:
|
||||
static void addmesh(struct tms_mesh *from, float dx, float dy, int *num_v, int *num_i);
|
||||
static void recreate_meshes();
|
||||
|
||||
static bool initialized;
|
||||
static tms_varray *va;
|
||||
static tms_gbuffer *vbuf;
|
||||
static tms_gbuffer *ibuf;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -162,11 +162,6 @@ const struct terrain_edit default_tileset[] =
|
|||
|
||||
const int NUM_DEFAULT_TILES = sizeof(default_tileset)/sizeof(default_tileset[0]);
|
||||
|
||||
static inline bool is_surface_level(int pos_y, float *heights)
|
||||
{
|
||||
return ((pos_y+1)*8.f > heights[7] && (pos_y)*8.f < heights[7]);
|
||||
}
|
||||
|
||||
static inline bool check_depth_range(int chunk_y, float *heights, float min_y, float max_y)
|
||||
{
|
||||
float h = heights[7];
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ enum {
|
|||
|
||||
extern uint32_t _gentype_id;
|
||||
|
||||
static inline bool is_surface_level(int pos_y, float *heights) {
|
||||
return ((pos_y+1)*8.f > heights[7] && (pos_y)*8.f < heights[7]);
|
||||
}
|
||||
|
||||
struct gentype_generator
|
||||
{
|
||||
const char *name;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
#define RADIUS .04f
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::mesh *mesh;
|
||||
static tms::entity *e;
|
||||
tms::gbuffer *ledbuffer::verts;
|
||||
tms::gbuffer *ledbuffer::indices;
|
||||
tms::varray *ledbuffer::va;
|
||||
tms::mesh *ledbuffer::mesh;
|
||||
tms::entity *ledbuffer::e;
|
||||
|
||||
static int n = 0;
|
||||
int ledbuffer::n = 0;
|
||||
|
||||
static tvec4 base[9];
|
||||
tvec4 ledbuffer::base[9];
|
||||
|
||||
void ledbuffer::reset()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,4 +14,14 @@ class ledbuffer
|
|||
static void upload();
|
||||
static void add(float x, float y, float z, float col);
|
||||
static tms::entity *get_entity();
|
||||
|
||||
private:
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::mesh *mesh;
|
||||
static tms::entity *e;
|
||||
|
||||
static int n;
|
||||
static tvec4 base[9];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
#include "linebuffer.hh"
|
||||
#include "game.hh"
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
tms::gbuffer *linebuffer::verts;
|
||||
tms::gbuffer *linebuffer::verts2;
|
||||
tms::gbuffer *linebuffer::indices;
|
||||
tms::varray *linebuffer::va;
|
||||
tms::varray *linebuffer::va2;
|
||||
tms::mesh *linebuffer::mesh;
|
||||
tms::mesh *linebuffer::mesh2;
|
||||
tms::entity *linebuffer::e;
|
||||
tms::entity *linebuffer::e2;
|
||||
|
||||
static float cam_x = 0.f;
|
||||
static float cam_y = 0.f;
|
||||
|
||||
static int n = 0;
|
||||
static int n2 = 0;
|
||||
int linebuffer::n = 0;
|
||||
int linebuffer::n2 = 0;
|
||||
|
||||
struct linebuf_vert {
|
||||
tvec3 pos;
|
||||
|
|
|
|||
|
|
@ -26,4 +26,18 @@ class linebuffer
|
|||
);
|
||||
static tms::entity *get_entity();
|
||||
static tms::entity *get_entity2();
|
||||
|
||||
private:
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
|
||||
static int n;
|
||||
static int n2;
|
||||
};
|
||||
|
|
|
|||
12
src/pixel.cc
12
src/pixel.cc
|
|
@ -13,17 +13,17 @@ struct pixel_vert {
|
|||
tvec3 col;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct tms_mesh *_mesh[3];
|
||||
static struct tms_entity *_e[3];
|
||||
static tms::varray *_va[3];
|
||||
static tms::gbuffer *_buf[3];
|
||||
static tms::gbuffer *_ibuf;
|
||||
tms_mesh *pixel::_mesh[3];
|
||||
tms_entity *pixel::_e[3];
|
||||
tms::varray *pixel::_va[3];
|
||||
tms::gbuffer *pixel::_buf[3];
|
||||
tms::gbuffer *pixel::_ibuf;
|
||||
static volatile int _counter[3] = {0,0,0};
|
||||
|
||||
static int vertices_per_pixel = 0;
|
||||
static int indices_per_pixel = 0;
|
||||
|
||||
static float _cam_x = 0.f, _cam_y = 0.f;
|
||||
float pixel::_cam_x = 0.f, pixel::_cam_y = 0.f;
|
||||
|
||||
#define MAX_PIXELS 8192*2
|
||||
|
||||
|
|
|
|||
|
|
@ -68,4 +68,13 @@ class pixel : public basepixel,
|
|||
this->last_size = lb->r_float();
|
||||
this->pending_value = lb->r_float();
|
||||
}
|
||||
|
||||
private:
|
||||
static tms_mesh *_mesh[3];
|
||||
static tms_entity *_e[3];
|
||||
static tms::varray *_va[3];
|
||||
static tms::gbuffer *_buf[3];
|
||||
static tms::gbuffer *_ibuf;
|
||||
|
||||
static float _cam_x, _cam_y;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -107,14 +107,14 @@ enum {
|
|||
};
|
||||
|
||||
bool plant::initialized = false;
|
||||
static struct tms_gbuffer *ibuf = 0;
|
||||
static struct tms_gbuffer *vbuf = 0;
|
||||
static struct tms_varray *va = 0;
|
||||
tms_gbuffer *plant::ibuf = 0;
|
||||
tms_gbuffer *plant::vbuf = 0;
|
||||
tms_varray *plant::va = 0;
|
||||
static int branch_slots[MAX_BRANCHES];
|
||||
static int top_slot = 0;
|
||||
static bool buffer_modified = false;
|
||||
|
||||
static int counter;
|
||||
int plant::counter = 0;
|
||||
|
||||
struct plant_vert {
|
||||
tvec3 pos;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class plant : public entity_simpleconnect
|
|||
float pending_timer;
|
||||
b2Vec2 pending_normal;
|
||||
|
||||
static bool initialized;
|
||||
|
||||
static void _init();
|
||||
|
||||
inline float rand_range(tvec2 v)
|
||||
|
|
@ -338,4 +338,11 @@ class plant : public entity_simpleconnect
|
|||
|
||||
plant_section root_section;
|
||||
plant_branch root_branch;
|
||||
|
||||
private:
|
||||
static bool initialized;
|
||||
static tms_gbuffer *ibuf;
|
||||
static tms_gbuffer *vbuf;
|
||||
static tms_varray *va;
|
||||
static int counter;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
#include "game.hh"
|
||||
#include "ui.hh"
|
||||
|
||||
struct tms_varray *va;
|
||||
struct tms_gbuffer *vbuf;
|
||||
struct tms_gbuffer *ibuf;
|
||||
polygon *slots[MAX_POLYGONS];
|
||||
bool modified; /* if the vertex buffer has been modified */
|
||||
tms_varray *polygon::va;
|
||||
tms_gbuffer *polygon::vbuf;
|
||||
tms_gbuffer *polygon::ibuf;
|
||||
polygon *polygon::slots[MAX_POLYGONS];
|
||||
bool polygon::modified; // if the vertex buffer has been modified
|
||||
|
||||
struct poly_vert {
|
||||
tvec3 pos;
|
||||
|
|
|
|||
|
|
@ -112,4 +112,11 @@ class polygon : public composable, public b2RayCastCallback
|
|||
void find_pairs();
|
||||
float32 ReportFixture(b2Fixture *f, const b2Vec2 &pt, const b2Vec2 &nor, float32 fraction);
|
||||
connection *load_connection(connection &conn);
|
||||
|
||||
private:
|
||||
static tms_varray *va;
|
||||
static tms_gbuffer *vbuf;
|
||||
static tms_gbuffer *ibuf;
|
||||
static polygon *slots[MAX_POLYGONS];
|
||||
static bool modified;
|
||||
};
|
||||
|
|
|
|||
14
src/rope.cc
14
src/rope.cc
|
|
@ -12,14 +12,14 @@
|
|||
#define MAX_ROPES 20
|
||||
|
||||
bool rope::initialized = false;
|
||||
static struct tms_mesh *_mesh;
|
||||
static struct tms_entity *_e;
|
||||
static float _cam_x = 0.f, _cam_y = 0.f;
|
||||
static tms::varray *va = 0;
|
||||
static tms::gbuffer *buf = 0;
|
||||
static tms::gbuffer *ibuf = 0;
|
||||
tms::varray *rope::va = 0;
|
||||
tms::gbuffer *rope::buf = 0;
|
||||
tms::gbuffer *rope::ibuf = 0;
|
||||
tms_mesh *rope::_mesh;
|
||||
tms_entity *rope::_e;
|
||||
float rope::_cam_x = 0.f, rope::_cam_y = 0.f;
|
||||
|
||||
static volatile int counter = 1;
|
||||
volatile int rope::counter = 1;
|
||||
|
||||
struct rope_vert {
|
||||
tvec3 pos;
|
||||
|
|
|
|||
10
src/rope.hh
10
src/rope.hh
|
|
@ -75,4 +75,14 @@ class rope : public entity,
|
|||
|
||||
/* (num_bodies + ROPE_LENGTH) * 3 */
|
||||
float state[(2 + ROPE_LENGTH) * 3];
|
||||
|
||||
private:
|
||||
static tms::varray *va;
|
||||
static tms::gbuffer *buf;
|
||||
static tms::gbuffer *ibuf;
|
||||
static tms_mesh *_mesh;
|
||||
static tms_entity *_e;
|
||||
static float _cam_x, _cam_y;
|
||||
|
||||
static volatile int counter;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
#include "spritebuffer.hh"
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
tms::gbuffer *spritebuffer::verts;
|
||||
tms::gbuffer *spritebuffer::verts2;
|
||||
tms::gbuffer *spritebuffer::indices;
|
||||
tms::varray *spritebuffer::va;
|
||||
tms::varray *spritebuffer::va2;
|
||||
tms::mesh *spritebuffer::mesh;
|
||||
tms::mesh *spritebuffer::mesh2;
|
||||
tms::entity *spritebuffer::e;
|
||||
tms::entity *spritebuffer::e2;
|
||||
|
||||
static int n = 0;
|
||||
static int n2 = 0;
|
||||
int spritebuffer::n = 0;
|
||||
int spritebuffer::n2 = 0;
|
||||
|
||||
struct spritebuf_vert {
|
||||
tvec3 pos;
|
||||
|
|
@ -19,7 +19,7 @@ struct spritebuf_vert {
|
|||
tvec4 color;
|
||||
};
|
||||
|
||||
static spritebuf_vert base[4];
|
||||
spritebuf_vert spritebuffer::base[4];
|
||||
|
||||
void spritebuffer::reset()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,4 +16,20 @@ class spritebuffer
|
|||
static void add2(float x, float y, float z, float r, float g, float b, float a, float w, float h, int sprite, float rot);
|
||||
static tms::entity *get_entity();
|
||||
static tms::entity *get_entity2();
|
||||
|
||||
private:
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
|
||||
static int n;
|
||||
static int n2;
|
||||
|
||||
static struct spritebuf_vert base[4];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -328,11 +328,6 @@ chunk_window::generate_heightmap(int chunk_x, bool search)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool is_surface_level(int pos_y, float *heights)
|
||||
{
|
||||
return ((pos_y+1)*8.f > heights[7] && (pos_y)*8.f < heights[7]);
|
||||
}
|
||||
|
||||
void
|
||||
level_chunk::generate_phase6(chunk_window *win)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
#include "textbuffer.hh"
|
||||
#include "material.hh"
|
||||
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
tms::gbuffer *textbuffer::verts;
|
||||
tms::gbuffer *textbuffer::verts2;
|
||||
tms::gbuffer *textbuffer::indices;
|
||||
tms::varray *textbuffer::va;
|
||||
tms::varray *textbuffer::va2;
|
||||
tms::mesh *textbuffer::mesh;
|
||||
tms::mesh *textbuffer::mesh2;
|
||||
tms::entity *textbuffer::e;
|
||||
tms::entity *textbuffer::e2;
|
||||
|
||||
static int n = 0;
|
||||
static int n2 = 0;
|
||||
int textbuffer::n = 0;
|
||||
int textbuffer::n2 = 0;
|
||||
|
||||
struct textbuf_vert {
|
||||
tvec3 pos;
|
||||
|
|
@ -20,7 +20,7 @@ struct textbuf_vert {
|
|||
tvec4 color;
|
||||
};
|
||||
|
||||
static textbuf_vert base[4];
|
||||
textbuf_vert textbuffer::base[4];
|
||||
|
||||
void textbuffer::_init()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,4 +20,20 @@ class textbuffer
|
|||
static void add_text(const char *text, p_font *font, float x, float y, float z, float r, float g, float b, float a, float scale, uint8_t horizontal_align=ALIGN_CENTER, uint8_t vertical_align=ALIGN_CENTER, bool bg=false);
|
||||
static void add_text2(const char *text, p_font *font, float x, float y, float z, float r, float g, float b, float a, float scale, uint8_t horizontal_align=ALIGN_CENTER, uint8_t vertical_align=ALIGN_CENTER);
|
||||
static void add_bg(float x, float y, float z, float r, float g, float b, float a, float w, float h);
|
||||
|
||||
private:
|
||||
static tms::gbuffer *verts;
|
||||
static tms::gbuffer *verts2;
|
||||
static tms::gbuffer *indices;
|
||||
static tms::varray *va;
|
||||
static tms::varray *va2;
|
||||
static tms::mesh *mesh;
|
||||
static tms::mesh *mesh2;
|
||||
static tms::entity *e;
|
||||
static tms::entity *e2;
|
||||
|
||||
static int n;
|
||||
static int n2;
|
||||
|
||||
static struct textbuf_vert base[4];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ struct tpixel_material tpixel_materials[NUM_TPIXEL_MATERIALS] = {
|
|||
};
|
||||
|
||||
bool tpixel::initialized = false;
|
||||
static bool _modified = false;
|
||||
bool tpixel::_modified = false;
|
||||
|
||||
struct tpixel_vert {
|
||||
tvec3 pos;
|
||||
|
|
@ -186,17 +186,17 @@ struct tpixel_vert {
|
|||
tvec2 uv;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct tms_mesh *_mesh[3];
|
||||
static struct tms_entity *_e[3];
|
||||
static tms::varray *_va[3];
|
||||
static tms::gbuffer *_buf[3];
|
||||
static tms::gbuffer *_ibuf;
|
||||
static volatile int _counter[3] = {0,0,0};
|
||||
tms_mesh *tpixel::_mesh[3];
|
||||
tms_entity *tpixel::_e[3];
|
||||
tms::varray *tpixel::_va[3];
|
||||
tms::gbuffer *tpixel::_buf[3];
|
||||
tms::gbuffer *tpixel::_ibuf;
|
||||
volatile int tpixel::_counter[3] = {0,0,0};
|
||||
|
||||
static int vertices_per_tpixel = 0;
|
||||
static int indices_per_tpixel = 0;
|
||||
int tpixel::vertices_per_tpixel = 0;
|
||||
int tpixel::indices_per_tpixel = 0;
|
||||
|
||||
static float _cam_x = 0.f, _cam_y = 0.f;
|
||||
float tpixel::_cam_x = 0.f, tpixel::_cam_y = 0.f;
|
||||
|
||||
#define MAX_TPIXELS 8192*2
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class tpixel : public basepixel
|
|||
|
||||
tpixel();
|
||||
|
||||
static bool initialized;
|
||||
|
||||
static void initialize();
|
||||
static struct tms_entity *get_entity(int x);
|
||||
static void reset_counter();
|
||||
|
|
@ -139,6 +139,21 @@ class tpixel : public basepixel
|
|||
float get_slider_value(int s);
|
||||
const char *get_slider_label(int s){if (s==0)return basepixel::get_slider_label(s);else return "Material";};
|
||||
void on_slider_change(int s, float value);
|
||||
|
||||
private:
|
||||
static bool initialized;
|
||||
static bool _modified;
|
||||
|
||||
static tms_mesh *_mesh[3];
|
||||
static tms_entity *_e[3];
|
||||
static tms::varray *_va[3];
|
||||
static tms::gbuffer *_buf[3];
|
||||
static tms::gbuffer *_ibuf;
|
||||
static volatile int _counter[3];
|
||||
|
||||
static int vertices_per_tpixel, indices_per_tpixel;
|
||||
|
||||
static float _cam_x, _cam_y;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue