renderUtil
-
class DynRenderBuffer
- #include <dynRenderBuf.h>
Used to render various geometry by means of built-in shader buffer (see #DynamicShadersBuffer). At first the data are accumulated in internal class’s buffer, then after calling flushToBuffer() they are moved to shader buffer. After call to flush() the data are displayed on the screen.
Data render methods.
-
typedef Tab<int> FaceTab
-
DynamicShadersBuffer *edBuffer
-
CompiledShaderChannelId channels[3]
-
Ptr<ShaderMaterial> edMat
-
Ptr<ShaderElement> edShader
-
int texVarId
-
int texSamplerstateVarId
-
unsigned vertexMaxCount
-
unsigned faceMaxCount
-
inline void flushToBuffer(TEXTUREID tid)
The function begins process of rendering shader geometry and calls addFaces().
- Parameters:
tid – [in] - ID of texture used for rendering
-
void addFaces(TEXTUREID tid)
The function moves data from internal buffer to shader buffer.
- Parameters:
tid – [in] - ID of texture used for rendering
-
void flush()
The function outputs shader buffer to screen and ends process of rendering shader geometry (see #ShaderMesh::end_render()).
-
inline void addInd(int *i, int numi, int sv)
-
void createBuffer(int max_verts, int max_faces)
Data accumulation methods.
-
void clearBuf()
Clear buffer.
-
void drawCustom(dag::ConstSpan<Vertex> vertex_tab, dag::ConstSpan<int> face_tab)
Put arbitrary geometry in buffer.
- Parameters:
vertex_tab – [in] - array of vertexes
face_tab – [in] - array of vertex indexes
-
Vertex *drawNetSurface(int w, int h)
starts filling data for net surface; reserves space for w*h vertices and inits indices; returns pointer to first vertex, vertices are arranged as (0,0), (1,0) … (w-1,0), (0, 1), (1,1), etc.
-
void drawQuad(const Point3 &p0, const Point3 &p1, const Point3 &p2, const Point3 &p3, E3DCOLOR color, float u = 1, float v = 1)
Put quad in buffer.
- Parameters:
p0, p1, p2, p3 – [in] - coordinates of vertexes
color – [in] - quad color
-
void drawLine(const Point3 &from, const Point3 &to, real width, E3DCOLOR color)
Place rectangular line on surface perpendicular to camera line of view and put it in buffer.
- Parameters:
from – [in] - start coordinates of the line
to – [in] - end coordinates of the line
width – [in] - line width
color – [in] - line color
-
void drawSquare(const Point3 &p, real radius, E3DCOLOR color)
Place square on surface perpendicular to camera line of view and put it in buffer.
- Parameters:
p – [in] - coordinates of square center
radius – [in] - half length of square side
color – [in] - square color
-
void drawDebugSphere(const Point3 &pos, real radius, real width, E3DCOLOR color)
Place ring on surface perpendicular to camera line of view and put it in buffer.
- Parameters:
pos – [in] - coordinates of ring center
radius – [in] - ring radius
width – [in] - ring width
color – [in] - ring color
-
void drawWireSphere(const Point3 &pos, real radius, real width, E3DCOLOR color)
-
void drawBox(const TMatrix &tm, E3DCOLOR color)
Put parallelepiped (box) in buffer.
- Parameters:
tm – [in] - the matrix that defines coordinates, dimensions and rotation of the parallelepiped. Parallelepiped is the result of matrix multiplication, where one matrix represents cube with side equal 1 metre and other matrix is tm matrix.
color – [in] - parallelepiped color
Public Types
Public Functions
-
DynRenderBuffer(const char *class_name = "editor_helper")
Constructor.
- Parameters:
class_name – [in] - name of shader used for rendering
-
~DynRenderBuffer()
Destructor.
-
inline int getVertexCount() const
Get vertex count.
- Returns:
number of vertices in buffer
-
inline int getIndexCount() const
Get vertex index count.
- Returns:
number of vertex indexes in buffer
-
typedef Tab<int> FaceTab