Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
material.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "inexor/network/SharedVar.hpp" // for SharedVar
4 #include "inexor/shared/cube_types.hpp" // for ushort
5 #include "inexor/shared/cube_vector.hpp" // for vector
6 
7 struct cube;
8 struct ivec;
9 struct materialsurface;
10 
11 enum
12 {
17 
22 };
23 
24 enum // cube empty-space materials
25 {
26  MAT_AIR = 0, // the default, fill the empty space with air
27  MAT_WATER = 1 << MATF_VOLUME_SHIFT, // fill with water, showing waves at the surface
28  MAT_LAVA = 2 << MATF_VOLUME_SHIFT, // fill with lava
29  MAT_GLASS = 3 << MATF_VOLUME_SHIFT, // behaves like clip but is blended blueish
30 
31  MAT_NOCLIP = 1 << MATF_CLIP_SHIFT, // collisions always treat cube as empty
32  MAT_CLIP = 2 << MATF_CLIP_SHIFT, // collisions always treat cube as solid
33  MAT_GAMECLIP = 3 << MATF_CLIP_SHIFT, // game specific clip material
34 
35  MAT_DEATH = 1 << MATF_FLAG_SHIFT, // force player suicide
36  MAT_ALPHA = 4 << MATF_FLAG_SHIFT // alpha blended
37 };
38 
39 #define isliquid(mat) ((mat)==MAT_WATER || (mat)==MAT_LAVA)
40 #define isclipped(mat) ((mat)==MAT_GLASS)
41 #define isdeadly(mat) ((mat)==MAT_LAVA)
42 
43 extern SharedVar<int> showmat;
44 
45 extern int findmaterial(const char *name);
46 extern const char *findmaterialname(int mat);
47 extern const char *getmaterialdesc(int mat, const char *prefix = "");
48 extern void genmatsurfs(const cube &c, const ivec &co, int size, vector<materialsurface> &matsurfs);
49 extern void rendermatgrid(materialsurface *matbuf, int matsurfs);
50 extern int optimizematsurfs(materialsurface *matbuf, int matsurfs);
51 extern void setupmaterials(int start = 0, int len = 0);
52 extern void rendermaterials();
53 extern int visiblematerial(const cube &c, int orient, const ivec &co, int size, ushort matmask = MATF_VOLUME);
54 
const char * findmaterialname(int mat)
Definition: material.cpp:204
Definition: material.hpp:16
Definition: material.hpp:32
void rendermaterials()
Definition: material.cpp:706
SharedVar< int > showmat
void genmatsurfs(const cube &c, const ivec &co, int size, vector< materialsurface > &matsurfs)
Definition: material.cpp:254
Definition: material.hpp:36
int findmaterial(const char *name)
Definition: material.cpp:195
Definition: material.hpp:18
Definition: material.hpp:19
Definition: octree.hpp:31
Definition: material.hpp:31
Definition: material.hpp:33
Definition: material.hpp:27
unsigned short ushort
Definition: cube_types.hpp:8
int visiblematerial(const cube &c, int orient, const ivec &co, int size, ushort matmask=MATF_VOLUME)
Definition: material.cpp:227
void start(const char *filename, int videofps, int videow, int videoh, bool sound)
Definition: movie.cpp:975
Definition: material.hpp:13
int optimizematsurfs(materialsurface *matbuf, int matsurfs)
Definition: material.cpp:353
Definition: material.hpp:14
Definition: material.hpp:21
const char * getmaterialdesc(int mat, const char *prefix="")
Definition: material.cpp:210
int orient
Definition: octaedit.cpp:164
GLuint GLuint GLintptr GLsizeiptr size
Definition: glexts.hpp:412
SharedVar wrapper for primitive/immutable objects.
Definition: SharedVar.hpp:55
Definition: material.hpp:35
3-dimensional INTEGER vectors
Definition: geom.hpp:1226
Definition: material.hpp:28
Definition: material.hpp:20
Definition: octree.hpp:208
Definition: material.hpp:29
void setupmaterials(int start=0, int len=0)
Definition: material.cpp:434
Definition: material.hpp:15
Definition: material.hpp:26
void rendermatgrid(materialsurface *matbuf, int matsurfs)