My Project: openb3dlib.mod/openb3d/src/surface.h Source File

My Project

surface.h
Go to the documentation of this file.
1 /*
2 * surface.h
3 * iminib3d
4 *
5 * Created by Simon Harrison.
6 * Copyright Si Design. All rights reserved.
7 *
8 */
9
10 #ifndef SURFACE_H
11 #define SURFACE_H
12
13 #include "brush.h"
14 #include "shadermat.h"
15
16 #include <vector>
17 using namespace std;
18
19 class Surface{
20
21 public:
22
23 // no of vertices and triangles in surface
24
25 int no_verts;
26 int no_tris;
27
28 // arrays containing vertex and triangle info
29
30 vector<float> vert_coords;
31 vector<float> vert_norm;
32 vector<float> vert_tex_coords0;
33 vector<float> vert_tex_coords1;
34 vector<float> vert_col;
35 vector<unsigned short> tris;
36
37 // arrays containing vertex bone no and weights info - used by animated meshes only
38
39 vector<int> vert_bone1_no; // stores bone no - bone no used to reference bones[] array belonging to TMesh
40 vector<int> vert_bone2_no;
41 vector<int> vert_bone3_no;
42 vector<int> vert_bone4_no;
43 vector<float> vert_weight1;
44 vector<float> vert_weight2;
45 vector<float> vert_weight3;
46 vector<float> vert_weight4;
47
48 // brush applied to surface
49
50 Brush* brush;
51 Shader* ShaderMat;
52
53 // vbo
54
55 unsigned int vbo_id[7];
56
57 // misc vars
58
59 int vert_array_size;
60 int tri_array_size;
61 int vmin; // used for trimming verts from b3d files
62 int vmax; // used for trimming verts from b3d files
63
64 // reset flag - this is set when mesh shape is changed in TSurface and TMesh
65 int vbo_enabled;
66 int reset_vbo; // (-1 = all)
67
68 // used by Compare to sort array, and TMesh.Update to enable/disable alpha blending
69 int alpha_enable;
70
71 Surface();
72 ~Surface();
73 Surface* Copy();
74 void ClearSurface(int clear_verts=true,int clear_tris=true);
75 int AddVertex(float x,float y,float z,float u=0.0,float v=0.0,float w=0.0);
76 int AddTriangle(unsigned short,unsigned short,unsigned short);
77 int CountVertices();
78 int CountTriangles();
79 void VertexCoords(int vid,float x,float y,float z);
80 void VertexNormal(int vid,float nx,float ny,float nz);
81 void VertexColor(int vid,float r,float g,float b,float a=1.0);
82 void VertexTexCoords(int vid,float u,float v,float w=0.0,int coord_set=0);
83 float VertexX(int vid);
84 float VertexY(int vid);
85 float VertexZ(int vid);
86 float VertexRed(int vid);
87 float VertexGreen(int vid);
88 float VertexBlue(int vid);
89 float VertexAlpha(int vid);
90 float VertexNX(int vid);
91 float VertexNY(int vid);
92 float VertexNZ(int vid);
93 float VertexU(int vid,int coord_set=0);
94 float VertexV(int vid,int coord_set=0);
95 float VertexW(int vid,int coord_set=0);
96 Brush* GetSurfaceBrush();
97 void PaintSurface(Brush* bru);
98 void SurfaceColor(float r,float g,float b,float a);
99 void SurfaceColor(float r,float g,float b);
100 void SurfaceRed(float r);
101 void SurfaceGreen(float g);
102 void SurfaceBlue(float b);
103 void SurfaceAlpha(float a);
104 void UpdateNormals();
105 int TriangleVertex(int tri_no,int corner);
106 float TriangleNX(int tri_no);
107 float TriangleNY(int tri_no);
108 float TriangleNZ(int tri_no);
109 void UpdateVBO();
110 void FreeVBO();
111 void RemoveTri(int tri);
112 void UpdateTexCoords();
113
114 };
115
116 #endif
Surface::vert_weight1
vector< float > vert_weight1
Definition: surface.h:43
UpdateTexCoords
void UpdateTexCoords(Surface *surf)
Definition: functions.cpp:1610
Surface::vert_weight2
vector< float > vert_weight2
Definition: surface.h:44
VertexZ
float VertexZ(Surface *surf, int vid)
Definition: functions.cpp:1769
CountVertices
int CountVertices(Surface *surf)
Definition: functions.cpp:449
SurfaceGreen
void SurfaceGreen(Surface *obj, float g)
Definition: methods.cpp:396
Surface::tris
vector< unsigned short > tris
Definition: surface.h:35
Surface
Definition: surface.h:19
VertexBlue
float VertexBlue(Surface *surf, int vid)
Definition: functions.cpp:1662
UpdateNormals
void UpdateNormals(Mesh *mesh)
Definition: functions.cpp:1603
VertexRed
float VertexRed(Surface *surf, int vid)
Definition: functions.cpp:1719
Surface::vmax
int vmax
Definition: surface.h:62
VertexNZ
float VertexNZ(Surface *surf, int vid)
Definition: functions.cpp:1712
Surface::vert_tex_coords0
vector< float > vert_tex_coords0
Definition: surface.h:32
Surface::reset_vbo
int reset_vbo
Definition: surface.h:66
FreeVBO
void FreeVBO(Surface *obj)
Definition: methods.cpp:428
TriangleNX
float TriangleNX(Surface *obj, int tri_no)
Definition: methods.cpp:412
std
Surface::vert_bone2_no
vector< int > vert_bone2_no
Definition: surface.h:40
Surface::vert_bone1_no
vector< int > vert_bone1_no
Definition: surface.h:39
CountTriangles
int CountTriangles(Surface *surf)
Definition: functions.cpp:442
brush.h
Surface::vert_norm
vector< float > vert_norm
Definition: surface.h:31
TriangleVertex
int TriangleVertex(Surface *surf, int tri_no, int corner)
Definition: functions.cpp:1589
Surface::brush
Brush * brush
Definition: surface.h:50
Surface::vert_col
vector< float > vert_col
Definition: surface.h:34
VertexNY
float VertexNY(Surface *surf, int vid)
Definition: functions.cpp:1705
Surface::vert_array_size
int vert_array_size
Definition: surface.h:59
Surface::vmin
int vmin
Definition: surface.h:61
TriangleNZ
float TriangleNZ(Surface *obj, int tri_no)
Definition: methods.cpp:420
Surface::no_verts
int no_verts
Definition: surface.h:25
VertexU
float VertexU(Surface *surf, int vid, int coord_set)
Definition: functions.cpp:1733
Surface::tri_array_size
int tri_array_size
Definition: surface.h:60
Surface::vert_weight3
vector< float > vert_weight3
Definition: surface.h:45
Surface::vert_bone4_no
vector< int > vert_bone4_no
Definition: surface.h:42
VertexX
float VertexX(Surface *surf, int vid)
Definition: functions.cpp:1755
PaintSurface
void PaintSurface(Surface *surf, Brush *brush)
Definition: functions.cpp:1150
Surface::vbo_enabled
int vbo_enabled
Definition: surface.h:65
SurfaceRed
void SurfaceRed(Surface *obj, float r)
Definition: methods.cpp:392
SurfaceColor
void SurfaceColor(Surface *obj, float r, float g, float b, float a)
Definition: methods.cpp:388
VertexGreen
float VertexGreen(Surface *surf, int vid)
Definition: functions.cpp:1684
VertexCoords
void VertexCoords(Surface *surf, int vid, float x, float y, float z)
Definition: functions.cpp:1676
RemoveTri
void RemoveTri(Surface *obj, int tri)
Definition: methods.cpp:432
VertexAlpha
float VertexAlpha(Surface *surf, int vid)
Definition: functions.cpp:1655
ClearSurface
void ClearSurface(Surface *surf, bool clear_verts, bool clear_tris)
Definition: functions.cpp:309
SurfaceAlpha
void SurfaceAlpha(Surface *obj, float a)
Definition: methods.cpp:404
VertexNX
float VertexNX(Surface *surf, int vid)
Definition: functions.cpp:1698
SurfaceBlue
void SurfaceBlue(Surface *obj, float b)
Definition: methods.cpp:400
VertexColor
void VertexColor(Surface *surf, int vid, float r, float g, float b, float a)
Definition: functions.cpp:1669
Surface::vert_tex_coords1
vector< float > vert_tex_coords1
Definition: surface.h:33
Shader
Definition: shadermat.h:56
shadermat.h
AddTriangle
int AddTriangle(Surface *surf, int v0, int v1, int v2)
Definition: functions.cpp:117
Surface::vert_bone3_no
vector< int > vert_bone3_no
Definition: surface.h:41
VertexV
float VertexV(Surface *surf, int vid, int coord_set)
Definition: functions.cpp:1741
UpdateVBO
void UpdateVBO(Surface *obj)
Definition: methods.cpp:424
Surface::ShaderMat
Shader * ShaderMat
Definition: surface.h:51
TriangleNY
float TriangleNY(Surface *obj, int tri_no)
Definition: methods.cpp:416
VertexW
float VertexW(Surface *surf, int vid, int coord_set)
Definition: functions.cpp:1748
Brush
Definition: brush.h:21
Surface::no_tris
int no_tris
Definition: surface.h:26
Surface::vert_weight4
vector< float > vert_weight4
Definition: surface.h:46
AddVertex
int AddVertex(Surface *surf, float x, float y, float z, float u, float v, float w)
Definition: functions.cpp:124
VertexNormal
void VertexNormal(Surface *surf, int vid, float nx, float ny, float nz)
Definition: functions.cpp:1691
Surface::alpha_enable
int alpha_enable
Definition: surface.h:69
Surface::vert_coords
vector< float > vert_coords
Definition: surface.h:30
GetSurfaceBrush
Brush * GetSurfaceBrush(Surface *surf)
Definition: functions.cpp:961
VertexTexCoords
void VertexTexCoords(Surface *surf, int vid, float u, float v, float w, int coord_set)
Definition: functions.cpp:1726
VertexY
float VertexY(Surface *surf, int vid)
Definition: functions.cpp:1762