78 M_BOOL bPass1_Enabled;
79 M_BOOL bPass2_Enabled;
84 const laColor &col = laColor(),
const double &width = 1, M_BOOL topmosy = M_FALSE)
92 bPass1_Enabled = bPass2_Enabled = M_TRUE;
101 M_BOOL _bShowProfiler;
110 double _dDetailTex_Scale;
111 laPoint3 _ptVarTexOffset;
117 virtual void create() = 0;
118 virtual void discard() = 0;
137 static unsigned _nMaxQuads;
152 virtual laPoint3 getCameraAngles() = 0;
157 virtual void modeWorld(
const laPoint3 &pos,
const laPoint3 &ang = laPoint3()) =0;
167 virtual void modeFog(M_BOOL bOn) =0;
187 virtual void vtex(
laTexture* pTex = NULL,
double scale = 0.2) = 0;
188 virtual void vtexOffset(laPoint3 ofs) { _ptVarTexOffset = ofs; }
192 inline laFont*
font(
char* strName) {
return _fontman.get(strName); }
196 virtual void lightMakeProjector(
unsigned nLight,
const laPoint3 &pos,
const laPoint3 &dir,
const double &angle=360) = 0;
197 virtual void lightMakeSunlight(
unsigned nLight,
const laPoint3 &pos) = 0;
199 virtual void lightAmbient(
unsigned nLight,
const laColor &rgb) = 0;
200 virtual void lightDiffuse(
unsigned nLight,
const laColor &rgb) = 0;
201 virtual void lightSpecular(
unsigned nLight,
const laColor &rgb) = 0;
202 virtual void lightAttenuation(
unsigned nLight,
double a) = 0;
204 virtual void lightSetCount(
unsigned n)=0;
209 virtual void fogColor(
const laColor &rgb) =0;
210 virtual void fogRange(
const double &start,
const double &end) =0;
211 virtual M_BOOL getFogMode()=0;
216 virtual void styleSet(
const laColor &diffuse,
const laColor &specular=laColor(255,255,255,255)) =0;
217 virtual void styleShininess(
unsigned s)=0;
218 virtual void styleLine(
double dWidth)=0;
220 virtual unsigned styleShaderLoad(
char* strShaderName) =0;
221 virtual void styleShader(
unsigned ShaderID) =0;
223 virtual void styleBackground(
const laColor &bg) {_rgbBg=bg;};
228 virtual void transTranslate(
const laPoint3 &pos)=0;
229 virtual void transRotate(
const double &ang,
const laPoint3 &axis)=0;
230 virtual void transScale(
const laPoint3 &sz)=0;
232 virtual void transPush()=0;
233 virtual void transPop()=0;
238 virtual unsigned compiledActivate(M_BOOL bOn) = 0;
239 virtual void compiledDraw(
unsigned nID) =0;
257 ASSERT(_nMaxQuads<nMaxQuads,
"Wrong argument");
258 laPoint3 *pv =
new laPoint3[ nMaxQuads*4 ];
260 laColor *pc =
new laColor[ nMaxQuads*4 ];
263 memcpy(pv, _arQuadData,
sizeof(laPoint3)*_nMaxQuads*4);
264 memcpy(pt, _arQuadUV,
sizeof(
laPoint2)*_nMaxQuads*4);
265 memcpy(pc, _arQuadRGB,
sizeof(laColor)*_nMaxQuads*4);
271 _arQuadData = pv; _arQuadUV = pt; _arQuadRGB = pc;
273 _nMaxQuads = nMaxQuads;
274 MLOG(
"VQ array resized %d", _nMaxQuads);
278 inline laPoint3*
vquadsData(
unsigned nQuad,
unsigned nCount = 1) {
279 if( (nQuad+nCount)>=_nMaxQuads )
vquadsAllocate( nQuad + nCount + 20 );
280 return _arQuadData + nQuad*4;
285 if( (nQuad+nCount)>=_nMaxQuads )
vquadsAllocate( nQuad + nCount + 20 );
286 return _arQuadUV + nQuad*4;
290 inline laColor*
vquadsCol(
unsigned nQuad,
unsigned nCount = 1) {
291 if( (nQuad+nCount)>=_nMaxQuads )
vquadsAllocate( nQuad + nCount + 20 );
292 return _arQuadRGB + nQuad*4;
296 virtual void vquadsDraw(
unsigned nQuads,
laPoint2 *ar_uv = NULL, laColor *ar_color = NULL,
297 M_BOOL bBillboards = M_FALSE, M_BOOL bUseColorArrays = M_FALSE) = 0;
308 PROFILE_REN(laRenderer_vquadsMakeBillboards);
317 for(
unsigned i=0; i<nQuads; i++) {
320 *(ppt++) = qv[0]*sz + ar_pos[i];
321 *(ppt++) = qv[1]*sz + ar_pos[i];
322 *(ppt++) = qv[2]*sz + ar_pos[i];
323 *(ppt++) = qv[3]*sz + ar_pos[i];
329 const laPoint3 &pos,
const laPoint3 &sz,
const laPoint2 &uv,
const laPoint2 &uv_sz )
331 PROFILE_REN(laRenderer_vquadsMakeXYRect);
336 *(pquad++) = pos + laPoint3(sz.x(), 0);
337 *(pquad++) = pos + laPoint3(sz);
338 *(pquad++) = pos + laPoint3(0, sz.y());
340 *(puv++) = uv +
laPoint2(0, uv_sz.y());
341 *(puv++) = uv + uv_sz;
342 *(puv++) = uv +
laPoint2(uv_sz.x(), 0);
350 virtual void trianglesDraw( laPoint3* ar_v,
laPoint2* ar_tv, laPoint3* ar_n,
unsigned nvert )=0;
352 virtual void drawRect(
const laPoint3 &pos,
const laPoint3 &sz,
const laPoint2 &uv,
const laPoint2 &uv_sz,
353 double an1=0,
double an2=0, M_BOOL bAlignX=M_TRUE)=0;
355 virtual void drawLine(
const laPoint3 &a,
const laPoint3 &b)=0;
357 virtual void drawEllipse2(laPoint3 a, laPoint3 b,
double z=0,
bool flat=
true,
bool lighten=
true) =0;
373 static M_BOOL _bDbgEnable;
374 static double _dDbgOfsX;
375 static double _dDbgOfsY;
378 #endif //#ifndef M_RENDERER_H
laFont * font(char *strName)
Get a font renderer.
laPoint2 * vquadsTexCoord(unsigned nQuad, unsigned nCount=1)
Get a pointer to VQ texture coordinates.
virtual void modeTexture(M_BOOL bOn)=0
Enable/disable texturing.
laOutline(M_BOOL bOn=M_TRUE, const laColor &col=laColor(), const double &width=1, M_BOOL topmosy=M_FALSE)
Outline constructor.
M_BOOL bEnabled
Is the outline enabled.
unsigned _nW
\ Camera-related varaibles
static laPoint2 * _arQuadUV
Quad texture coordinates.
virtual void modeFog(M_BOOL bOn)=0
Enable/disable fox.
unsigned nType
Texture opacity type (defined in Core-Parameters.h)
virtual void vquadsDrawSingle(laPoint2 *ar_uv=NULL)=0
Draw a single VQ (Note this is slower than drawing an array of VQ and should be avoided) ...
laTextureParams(unsigned type=M_TEX_SIMPLE, M_BOOL wrapu=M_TRUE, M_BOOL wrapv=M_TRUE)
Class constructor.
void vquadsMakeXYRect(unsigned nIndex, const laPoint3 &pos, const laPoint3 &sz, const laPoint2 &uv, const laPoint2 &uv_sz)
Makes a quad aligned to the XY plane; (handy for GUI rendering )
laColor * vquadsCol(unsigned nQuad, unsigned nCount=1)
Get a pointer to VQ color data.
static laPoint3 * _arQuadData
Internal variablse for storing "Volatile Quads" (used by the particle system and the GUI) ...
M_BOOL bTopmost
If set the outline is visible even when the object is behind something.
laPoint2 _ptCamAngY_sc
Precomputed sin/cos of camera angle.
Texture creation parameters used by laTexture.
unsigned vquadsCount() const
Current nuber of quads.
Object outline properties.
virtual void modeProfiler(M_BOOL bOn)
Show/hide profiler window.
unsigned _nH
Viewport width and height (in pixels)
laRenderer()
Default constructor for the renderer.
laColor color
Outline color.
laPoint2 _ptCamAng
Camera angle along vertical axis.
laFontManager _fontman
Font manager pointer.
unsigned id
Outline identifiery (should be unique for outlines that don't merge)
static laColor * _arQuadRGB
Quad colors.
virtual void modeBlend(M_BOOL bOn)=0
Enable/disable alpha blending (opacity)
M_BOOL isProfilerOn()
Query profiler window status.
virtual void vquadsDraw(unsigned nQuads, laPoint2 *ar_uv=NULL, laColor *ar_color=NULL, M_BOOL bBillboards=M_FALSE, M_BOOL bUseColorArrays=M_FALSE)=0
Draw an array of VQ, starting with the psecified pointers (or the first VQ if null) ...
virtual void modeOutline(const laOutline &outline)
Set outline parameters.
virtual void modeDepthBuffer(M_BOOL bOn)=0
Enable/disable depth buffer.
laOutline _outline
Active object outline.
laColor _rgbBg
Background clear color.
#define M_TEX_SIMPLE
Simple texture (no transparency)
double dWidth
Outline width.
Virtual interface for the Engine graphics renderer.
virtual void modeInterface()=0
Switch to interface rendering (2D projection mode)
virtual void modeLight(M_BOOL bOn)=0
Enable/disable lighting.
laPoint3 * vquadsData(unsigned nQuad, unsigned nCount=1)
Get a pointer to VQ vertex data.
virtual void commit()=0
Display renderer output.
virtual double modeBlendFilter(const double &dMinVisisbleAlpha)=0
Set a "blend filter" (cutting out elements with opacity lower than dMinVisisbleAlpha) ...
virtual void modeWorld(const laPoint3 &pos, const laPoint3 &ang=laPoint3())=0
Switch to "world rendering" (3D projection mode)
Engine Sub-systems Integrator.
virtual void vtexOffset(laPoint3 ofs)
Set detail texture offset.
void vquadsMakeBillboards(unsigned nQuads, laPoint3 *ar_pos, double *ar_size)
Use camera data to create an array of camera-facing VQ (handy for particle effects) ...
void vquadsAllocate(unsigned nMaxQuads)
Allocate memory for VQ (This is slow, so it should be called a minimal number ot times e...