Jimcpp 2.1.0
Jimcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IQ3Shader.hpp
1// Copyright (C) 2006-2012 Nikolaus Gebhardt / Thomas Alten
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in jimcpp/jimcpp.hpp
4
5#ifndef JPP_I_Q3_LEVEL_SHADER_HPP_INCLUDED
6#define JPP_I_Q3_LEVEL_SHADER_HPP_INCLUDED
7
8#include <jimcpp/core/engine/irrArray.hpp>
9#include <jimcpp/core/engine/fast_atof.hpp>
10#include <jimcpp/core/engine/IFileSystem.hpp>
11#include <jimcpp/core/engine/IVideoDriver.hpp>
12#include <jimcpp/core/engine/coreutil.hpp>
13#include <algorithm>
14
15namespace jpp::scene::quake3
16{
17
18static core::stringc irrEmptyStringc("");
19
21enum eQ3MeshIndex
22{
23 E_Q3_MESH_GEOMETRY = 0,
24 E_Q3_MESH_ITEMS,
25 E_Q3_MESH_BILLBOARD,
26 E_Q3_MESH_FOG,
27 E_Q3_MESH_UNRESOLVED,
28 E_Q3_MESH_SIZE
29};
30
35{
36public:
38 defaultLightMapMaterial ( video::EMT_LIGHTMAP_M4 ),
39 defaultModulate ( video::EMFN_MODULATE_4X ),
40 defaultFilter ( video::EMF_BILINEAR_FILTER ),
41 patchTesselation ( 8 ),
42 verbose ( 0 ),
43 startTime ( 0 ), endTime ( 0 ),
44 mergeShaderBuffer ( 1 ),
45 cleanUnResolvedMeshes ( 1 ),
46 loadAllShaders ( 0 ),
47 loadSkyShader ( 0 ),
48 alpharef ( 1 ),
49 swapLump ( 0 ),
50#ifdef __BIG_ENDIAN__
51 swapHeader ( 1 )
52#else
53 swapHeader ( 0 )
54#endif
55 {
56 std::copy_n("scripts\x0", 8, scriptDir);
57 }
58
59public:
60 video::E_MATERIAL_TYPE defaultLightMapMaterial;
61 video::E_MODULATE_FUNC defaultModulate;
62 video::E_MATERIAL_FLAG defaultFilter;
63 s32 patchTesselation;
64 s32 verbose;
65 u32 startTime;
66 u32 endTime;
67 s32 mergeShaderBuffer;
68 s32 cleanUnResolvedMeshes;
69 s32 loadAllShaders;
70 s32 loadSkyShader;
71 s32 alpharef;
72 s32 swapLump;
73 s32 swapHeader;
74 c8 scriptDir [ 64 ];
75};
76
77// some useful using type aliases
80
81// string helper.. TODO: move to generic files
82inline s16 isEqual ( const core::stringc &string, u32 &pos, const c8 * const list[], u16 listSize )
83{
84 const char * in = string.data() + pos;
85
86 for ( u16 i = 0; i != listSize; ++i )
87 {
88 if (string.size() < pos)
89 return -2;
90 u32 len = (u32) strlen ( list[i] );
91 if (string.size() < pos+len)
92 continue;
93 if ( in [len] != 0 && in [len] != ' ' )
94 continue;
95 if ( strncmp ( in, list[i], len ) )
96 continue;
97
98 pos += len + 1;
99 return (s16) i;
100 }
101 return -2;
102}
103
104inline f32 getAsFloat ( const core::stringc &string, u32 &pos )
105{
106 const char * in = string.data() + pos;
107
108 f32 value = 0.f;
109 pos += (u32) ( core::fast_atof_move ( in, value ) - in ) + 1;
110 return value;
111}
112
114inline core::vector3df getAsVector3df ( const core::stringc &string, u32 &pos )
115{
117
118 v.X = getAsFloat ( string, pos );
119 v.Z = getAsFloat ( string, pos );
120 v.Y = getAsFloat ( string, pos );
121
122 return v;
123}
124
125
126/*
127 extract substrings
128*/
129inline void getAsStringList ( tStringList &list, s32 max, const core::stringc &string, u32 &startPos )
130{
131 list.clear ();
132
133 s32 finish = 0;
134 s32 endPos;
135 do
136 {
137 endPos = string.findNext ( ' ', startPos );
138 if ( endPos == -1 )
139 {
140 finish = 1;
141 endPos = string.size();
142 }
143
144 list.push_back ( string.subString ( startPos, endPos - startPos ) );
145 startPos = endPos + 1;
146
147 if ( list.size() >= (u32) max )
148 finish = 1;
149
150 } while ( !finish );
151
152}
153
156{
157public:
159 type(video::EMT_SOLID),
160 modulate(mod),
161 param0(0.f),
162 isTransparent(0)
163 {}
164
165public:
167 video::E_MODULATE_FUNC modulate;
168
169 f32 param0;
170 u32 isTransparent;
171};
172
173// parses the content of Variable cull
174inline bool getCullingFunction ( const core::stringc &cull )
175{
176 if ( cull.size() == 0 )
177 return true;
178
179 bool ret = true;
180 static const c8 * funclist[] = { "none", "disable", "twosided" };
181
182 u32 pos = 0;
183 switch ( isEqual ( cull, pos, funclist, 3 ) )
184 {
185 case 0:
186 case 1:
187 case 2:
188 ret = false;
189 break;
190 }
191 return ret;
192}
193
194// parses the content of Variable depthfunc
195// return a z-test
196inline u8 getDepthFunction ( const core::stringc &string )
197{
199
200 if ( string.size() == 0 )
201 return ret;
202
203 static const c8 * funclist[] = { "lequal","equal" };
204
205 u32 pos = 0;
206 switch ( isEqual ( string, pos, funclist, 2 ) )
207 {
208 case 0:
210 break;
211 case 1:
212 ret = video::ECFN_EQUAL;
213 break;
214 }
215 return ret;
216}
217
229inline static void getBlendFunc ( const core::stringc &string, SBlendFunc &blendfunc )
230{
231 if ( string.size() == 0 )
232 return;
233
234 // maps to E_BLEND_FACTOR
235 static const c8 * funclist[] =
236 {
237 "gl_zero",
238 "gl_one",
239 "gl_dst_color",
240 "gl_one_minus_dst_color",
241 "gl_src_color",
242 "gl_one_minus_src_color",
243 "gl_src_alpha",
244 "gl_one_minus_src_alpha",
245 "gl_dst_alpha",
246 "gl_one_minus_dst_alpha",
247 "gl_src_alpha_sat",
248
249 "add",
250 "filter",
251 "blend",
252
253 "ge128",
254 "gt0",
255 };
256
257 u32 pos = 0;
258 s32 srcFact = isEqual ( string, pos, funclist, 16 );
259
260 if ( srcFact < 0 )
261 return;
262
263 u32 resolved = 0;
264 s32 dstFact = isEqual ( string, pos, funclist, 16 );
265
266 switch ( srcFact )
267 {
268 case video::EBF_ZERO:
269 switch ( dstFact )
270 {
271 // gl_zero gl_src_color == gl_dst_color gl_zero
273 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
274 blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
275 blendfunc.isTransparent = 1;
276 resolved = 1;
277 break;
278 } break;
279
280 case video::EBF_ONE:
281 switch ( dstFact )
282 {
283 // gl_one gl_zero
284 case video::EBF_ZERO:
285 blendfunc.type = video::EMT_SOLID;
286 blendfunc.isTransparent = 0;
287 resolved = 1;
288 break;
289
290 // gl_one gl_one
291 case video::EBF_ONE:
292 blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
293 blendfunc.isTransparent = 1;
294 resolved = 1;
295 break;
296 } break;
297
299 switch ( dstFact )
300 {
301 // gl_src_alpha gl_one_minus_src_alpha
304 blendfunc.param0 = 1.f/255.f;
305 blendfunc.isTransparent = 1;
306 resolved = 1;
307 break;
308 } break;
309
310 case 11:
311 // add
312 blendfunc.type = video::EMT_TRANSPARENT_ADD_COLOR;
313 blendfunc.isTransparent = 1;
314 resolved = 1;
315 break;
316 case 12:
317 // filter = gl_dst_color gl_zero or gl_zero gl_src_color
318 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
319 blendfunc.param0 = video::pack_textureBlendFunc ( video::EBF_DST_COLOR, video::EBF_ZERO, blendfunc.modulate );
320 blendfunc.isTransparent = 1;
321 resolved = 1;
322 break;
323 case 13:
324 // blend = gl_src_alpha gl_one_minus_src_alpha
326 blendfunc.param0 = 1.f/255.f;
327 blendfunc.isTransparent = 1;
328 resolved = 1;
329 break;
330 case 14:
331 // alphafunc ge128
333 blendfunc.param0 = 0.5f;
334 blendfunc.isTransparent = 1;
335 resolved = 1;
336 break;
337 case 15:
338 // alphafunc gt0
340 blendfunc.param0 = 1.f / 255.f;
341 blendfunc.isTransparent = 1;
342 resolved = 1;
343 break;
344
345 }
346
347 // use the generic blender
348 if ( 0 == resolved )
349 {
350 blendfunc.type = video::EMT_ONETEXTURE_BLEND;
351 blendfunc.param0 = video::pack_textureBlendFunc (
352 (video::E_BLEND_FACTOR) srcFact,
353 (video::E_BLEND_FACTOR) dstFact,
354 blendfunc.modulate);
355
356 blendfunc.isTransparent = 1;
357 }
358}
359
360// random noise [-1;1]
362{
363public:
364 static f32 get ()
365 {
366 static u32 RandomSeed = 0x69666966;
367 RandomSeed = (RandomSeed * 3631 + 1);
368
369 f32 value = ( (f32) (RandomSeed & 0x7FFF ) * (1.0f / (f32)(0x7FFF >> 1) ) ) - 1.f;
370 return value;
371 }
372};
373
374enum eQ3ModifierFunction
375{
376 TCMOD = 0,
377 DEFORMVERTEXES = 1,
378 RGBGEN = 2,
379 TCGEN = 3,
380 MAP = 4,
381 ALPHAGEN = 5,
382
383 FUNCTION2 = 0x10,
384 SCROLL = FUNCTION2 + 1,
385 SCALE = FUNCTION2 + 2,
386 ROTATE = FUNCTION2 + 3,
387 STRETCH = FUNCTION2 + 4,
388 TURBULENCE = FUNCTION2 + 5,
389 WAVE = FUNCTION2 + 6,
390
391 IDENTITY = FUNCTION2 + 7,
392 VERTEX = FUNCTION2 + 8,
393 TEXTURE = FUNCTION2 + 9,
394 LIGHTMAP = FUNCTION2 + 10,
395 ENVIRONMENT = FUNCTION2 + 11,
396 DOLLAR_LIGHTMAP = FUNCTION2 + 12,
397 BULGE = FUNCTION2 + 13,
398 AUTOSPRITE = FUNCTION2 + 14,
399 AUTOSPRITE2 = FUNCTION2 + 15,
400 TRANSFORM = FUNCTION2 + 16,
401 EXACTVERTEX = FUNCTION2 + 17,
402 CONSTANT = FUNCTION2 + 18,
403 LIGHTINGSPECULAR = FUNCTION2 + 19,
404 MOVE = FUNCTION2 + 20,
405 NORMAL = FUNCTION2 + 21,
406 IDENTITYLIGHTING = FUNCTION2 + 22,
407
408 WAVE_MODIFIER_FUNCTION = 0x30,
409 SINUS = WAVE_MODIFIER_FUNCTION + 1,
410 COSINUS = WAVE_MODIFIER_FUNCTION + 2,
411 SQUARE = WAVE_MODIFIER_FUNCTION + 3,
412 TRIANGLE = WAVE_MODIFIER_FUNCTION + 4,
413 SAWTOOTH = WAVE_MODIFIER_FUNCTION + 5,
414 SAWTOOTH_INVERSE = WAVE_MODIFIER_FUNCTION + 6,
415 NOISE = WAVE_MODIFIER_FUNCTION + 7,
416
417 UNKNOWN = -2
418};
419
421{
422public:
424 masterfunc0 ( UNKNOWN ), masterfunc1( UNKNOWN ), func ( SINUS ),
425 tcgen( TEXTURE ), rgbgen ( IDENTITY ), alphagen ( UNKNOWN ),
426 base ( 0 ), amp ( 1 ), phase ( 0 ), frequency ( 1 ),
427 wave ( 1 ),
428 x ( 0 ), y ( 0 ), z( 0 ), count( 0 )
429 {}
430
431public:
432 // "tcmod","deformvertexes","rgbgen", "tcgen"
433 eQ3ModifierFunction masterfunc0;
434 // depends
435 eQ3ModifierFunction masterfunc1;
436 // depends
437 eQ3ModifierFunction func;
438
439 eQ3ModifierFunction tcgen;
440 eQ3ModifierFunction rgbgen;
441 eQ3ModifierFunction alphagen;
442
443public:
444 union
445 {
446 f32 base;
447 f32 bulgewidth;
448 };
449
450 union
451 {
452 f32 amp;
453 f32 bulgeheight;
454 };
455
456 f32 phase;
457
458 union
459 {
460 f32 frequency;
461 f32 bulgespeed;
462 };
463
464 union
465 {
466 f32 wave;
467 f32 div;
468 };
469
470public:
471 f32 x;
472 f32 y;
473 f32 z;
474 u32 count;
475
476public:
477 f32 evaluate ( f32 dt ) const
478 {
479 // phase in 0 and 1..
480 f32 x = core::fract( (dt + phase ) * frequency );
481 f32 y = 0.f;
482
483 switch ( func )
484 {
485 case SINUS:
486 y = sinf ( x * core::PI * 2.f );
487 break;
488 case COSINUS:
489 y = cosf ( x * core::PI * 2.f );
490 break;
491 case SQUARE:
492 y = x < 0.5f ? 1.f : -1.f;
493 break;
494 case TRIANGLE:
495 y = x < 0.5f ? ( 4.f * x ) - 1.f : ( -4.f * x ) + 3.f;
496 break;
497 case SAWTOOTH:
498 y = x;
499 break;
500 case SAWTOOTH_INVERSE:
501 y = 1.f - x;
502 break;
503 case NOISE:
504 y = Noiser::get();
505 break;
506 default:
507 break;
508 }
509
510 return base + ( y * amp );
511 }
512};
513
514inline core::vector3df getMD3Normal ( u32 i, u32 j )
515{
516 const f32 lng = i * 2.0f * core::PI / 255.0f;
517 const f32 lat = j * 2.0f * core::PI / 255.0f;
518 return core::vector3df(cosf ( lat ) * sinf ( lng ),
519 sinf ( lat ) * sinf ( lng ),
520 cosf ( lng ));
521}
522
523//
524inline void getModifierFunc ( SModifierFunction& fill, const core::stringc &string, u32 &pos )
525{
526 if ( string.size() == 0 )
527 return;
528
529 static const c8 * funclist[] =
530 {
531 "sin","cos","square",
532 "triangle", "sawtooth","inversesawtooth", "noise"
533 };
534
535 fill.func = (eQ3ModifierFunction) isEqual ( string,pos, funclist,7 );
536 fill.func = fill.func == UNKNOWN ? SINUS : (eQ3ModifierFunction) ((u32) fill.func + WAVE_MODIFIER_FUNCTION + 1);
537
538 fill.base = getAsFloat ( string, pos );
539 fill.amp = getAsFloat ( string, pos );
540 fill.phase = getAsFloat ( string, pos );
541 fill.frequency = getAsFloat ( string, pos );
542}
543
544// name = "a b c .."
546{
547public:
548 core::stringc name;
549 core::stringc content;
550
551public:
552 SVariable ( const c8 * n, const c8 *c = 0 ) : name ( n ), content (c) {}
553
554public:
555 virtual ~SVariable () {}
556
557public:
558 void clear ()
559 {
560 name = "";
561 content = "";
562 }
563
564 s32 isValid () const
565 {
566 return name.size();
567 }
568
569 bool operator == ( const SVariable &other ) const
570 {
571 return 0 == strcmp ( name.data(), other.name.data() );
572 }
573
574 bool operator < ( const SVariable &other ) const
575 {
576 return 0 > strcmp ( name.data(), other.name.data() );
577 }
578};
579
580// string database. "a" = "Hello", "b" = "1234.6"
582{
583public:
584 SVarGroup () { Variable.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE ); }
585
586public:
587 virtual ~SVarGroup () {}
588
589public:
590 u32 isDefined ( const c8 * name, const c8 * content = 0 ) const
591 {
592 for ( u32 i = 0; i != Variable.size (); ++i )
593 {
594 if ( 0 == strcmp ( Variable[i].name.data(), name ) &&
595 ( 0 == content || strstr ( Variable[i].content.data(), content ) )
596 )
597 {
598 return i + 1;
599 }
600 }
601 return 0;
602 }
603
604 // searches for Variable name and returns is content
605 // if Variable is not found a reference to an Empty String is returned
606 const core::stringc &get( const c8 * name ) const
607 {
608 SVariable search ( name );
609 s32 index = Variable.linear_search ( search );
610 if ( index < 0 )
611 return irrEmptyStringc;
612
613 return Variable [ index ].content;
614 }
615
616 // set the Variable name
617 void set ( const c8 * name, const c8 * content = 0 )
618 {
619 u32 index = isDefined ( name, 0 );
620 if ( 0 == index )
621 {
622 Variable.push_back ( SVariable ( name, content ) );
623 }
624 else
625 {
626 Variable [ index ].content = content;
627 }
628 }
629
630public:
632};
633
636{
637public:
639 {
640 VariableGroup.setAllocStrategy ( core::ALLOC_STRATEGY_SAFE );
641 }
642
643public:
644 virtual ~SVarGroupList () {}
645
646public:
647 core::array < SVarGroup > VariableGroup;
648};
649
652{
653public:
654 IShader ()
655 : ID ( 0 ), VarGroup ( 0 ) {}
656
657public:
658 bool operator == (const IShader &other ) const
659 {
660 return 0 == strcmp ( name.data(), other.name.data() );
661 //return name == other.name;
662 }
663
664 bool operator < (const IShader &other ) const
665 {
666 return strcmp ( name.data(), other.name.data() ) < 0;
667 //return name < other.name;
668 }
669
670 u32 getGroupSize () const
671 {
672 if ( 0 == VarGroup )
673 return 0;
674 return VarGroup->VariableGroup.size ();
675 }
676
677 const SVarGroup * getGroup ( u32 stage ) const
678 {
679 if ( 0 == VarGroup || stage >= VarGroup->VariableGroup.size () )
680 return 0;
681
682 return &VarGroup->VariableGroup [ stage ];
683 }
684
685public:
686 // id
687 s32 ID;
688 SVarGroupList * VarGroup; // reference
689
690 // Shader: shader name ( also first variable in first Vargroup )
691 // Entity: classname ( variable in Group(1) )
692 core::stringc name;
693};
694
695using IEntity = IShader;
696
698
699/*
700 dump shader like original layout, regardless of internal data holding
701 no recursive folding..
702*/
703inline void dumpVarGroup ( core::stringc &dest, const SVarGroup * group, s32 stack )
704{
705 core::stringc buf;
706
707 if ( stack > 0 )
708 {
709 buf = "";
710 for (s32 i = 0; i < stack - 1; ++i )
711 buf += '\t';
712
713 buf += "{\n";
714 dest.append ( buf );
715 }
716
717 for ( u32 g = 0; g != group->Variable.size(); ++g )
718 {
719 buf = "";
720 for (s32 i = 0; i < stack; ++i )
721 buf += '\t';
722
723 buf += group->Variable[g].name;
724 buf += " ";
725 buf += group->Variable[g].content;
726 buf += "\n";
727 dest.append ( buf );
728 }
729
730 if ( stack > 1 )
731 {
732 buf = "";
733 for (s32 i = 0; i < stack - 1; ++i )
734 buf += '\t';
735
736 buf += "}\n";
737 dest.append ( buf );
738 }
739}
740
744inline core::stringc & dumpShader ( core::stringc &dest, const IShader * shader, bool entity = false )
745{
746 if ( 0 == shader )
747 return dest;
748
749 const u32 size = shader->VarGroup->VariableGroup.size ();
750 for ( u32 i = 0; i != size; ++i )
751 {
752 const SVarGroup * group = &shader->VarGroup->VariableGroup[ i ];
753 dumpVarGroup ( dest, group, core::clamp( (int)i, 0, 2 ) );
754 }
755
756 if ( !entity )
757 {
758 if ( size <= 1 )
759 {
760 dest.append ( "{\n" );
761 }
762 dest.append ( "}\n" );
763 }
764 return dest;
765}
766
767/*
768 quake3 doesn't care much about tga & jpg
769 load one or multiple files stored in name started at startPos to the texture array textures
770 if texture is not loaded 0 will be added ( to find missing textures easier)
771*/
772inline void getTextures(tTexArray &textures,
773 const core::stringc &name, u32 &startPos,
774 const io::IFileSystem *fileSystem,
775 video::IVideoDriver* driver)
776{
777 static const char * const extension[] =
778 {
779 ".jpg",
780 ".jpeg",
781 ".png",
782 ".dds",
783 ".tga",
784 ".bmp",
785 ".pcx"
786 };
787
788 tStringList stringList;
789 getAsStringList(stringList, -1, name, startPos);
790
791 textures.clear();
792
793 io::path loadFile;
794 for ( u32 i = 0; i!= stringList.size (); ++i )
795 {
796 video::ITexture* texture = 0;
797 for (u32 g = 0; g != 7; ++g)
798 {
799 core::cutFilenameExtension ( loadFile, stringList[i] );
800
801 if ( loadFile == "$whiteimage" )
802 {
803 texture = driver->getTexture( "$whiteimage" );
804 if ( 0 == texture )
805 {
806 core::dimension2du s ( 2, 2 );
807 u32 image[4] = { 0xFFFFFFFF, 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF };
808 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
809 texture = driver->addTexture( "$whiteimage", w );
810 w->drop ();
811 }
812
813 }
814 else
815 if ( loadFile == "$redimage" )
816 {
817 texture = driver->getTexture( "$redimage" );
818 if ( 0 == texture )
819 {
820 core::dimension2du s ( 2, 2 );
821 u32 image[4] = { 0xFFFF0000, 0xFFFF0000,0xFFFF0000,0xFFFF0000 };
822 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
823 texture = driver->addTexture( "$redimage", w );
824 w->drop ();
825 }
826 }
827 else
828 if ( loadFile == "$blueimage" )
829 {
830 texture = driver->getTexture( "$blueimage" );
831 if ( 0 == texture )
832 {
833 core::dimension2du s ( 2, 2 );
834 u32 image[4] = { 0xFF0000FF, 0xFF0000FF,0xFF0000FF,0xFF0000FF };
835 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
836 texture = driver->addTexture( "$blueimage", w );
837 w->drop ();
838 }
839 }
840 else
841 if ( loadFile == "$checkerimage" )
842 {
843 texture = driver->getTexture( "$checkerimage" );
844 if ( 0 == texture )
845 {
846 core::dimension2du s ( 2, 2 );
847 u32 image[4] = { 0xFFFFFFFF, 0xFF000000,0xFF000000,0xFFFFFFFF };
848 video::IImage* w = driver->createImageFromData ( video::ECF_A8R8G8B8, s,&image );
849 texture = driver->addTexture( "$checkerimage", w );
850 w->drop ();
851 }
852 }
853 else
854 if ( loadFile == "$lightmap" )
855 {
856 texture = 0;
857 }
858 else
859 {
860 loadFile.append ( extension[g] );
861 }
862
863 texture = driver->findTexture( loadFile );
864 if ( texture )
865 break;
866
867 if ( fileSystem->existFile ( loadFile ) )
868 {
869 texture = driver->getTexture( loadFile );
870 if ( texture )
871 break;
872 texture = 0;
873 }
874 }
875 // take 0 Texture
876 textures.push_back(texture);
877 }
878}
879
882{
883};
884
885} // namespace jpp::scene::quake3
886
887#endif
888
Base class of most objects of the Jimcpp Engine.
Definition IReferenceCounted.hpp:46
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
T X
X coordinate of the vector.
Definition vector3d.hpp:450
Manages various Quake3 Shader Styles.
Definition IQ3Shader.hpp:882
A Parsed Shader Holding Variables ordered in Groups.
Definition IQ3Shader.hpp:652
Definition IQ3Shader.hpp:362
Definition IQ3Shader.hpp:35
A blend function for a q3 shader.
Definition IQ3Shader.hpp:156
Definition IQ3Shader.hpp:421
holding a group a variable
Definition IQ3Shader.hpp:636
Definition IQ3Shader.hpp:582
Definition IQ3Shader.hpp:546
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
Definition irrMath.hpp:164
const f32 PI
Constant for PI.
Definition irrMath.hpp:54
vector3d< f32 > vector3df
using type alias for a f32 3d vector.
Definition vector3d.hpp:487
const char * fast_atof_move(const char *in, f32 &result)
Provides a fast function for converting a string into a float.
Definition fast_atof.hpp:317
io::path & cutFilenameExtension(io::path &dest, const io::path &source)
cut the filename extension from a source file path and store it in a dest file path
Definition coreutil.hpp:48
string< c8 > stringc
using type alias for character strings
Definition irrString.hpp:1457
dimension2d< u32 > dimension2du
using type alias for an unsigned integer dimension.
Definition dimension2d.hpp:212
core::string< fschar_t > path
Type used for all file system related strings.
Definition path.hpp:17
E_BLEND_FACTOR
Definition SMaterial.hpp:25
@ EBF_DST_COLOR
src (destR, destG, destB, destA)
Definition SMaterial.hpp:28
@ EBF_SRC_COLOR
dest (srcR, srcG, srcB, srcA)
Definition SMaterial.hpp:30
@ EBF_ONE
src & dest (1, 1, 1, 1)
Definition SMaterial.hpp:27
@ EBF_SRC_ALPHA
src & dest (srcA, srcA, srcA, srcA)
Definition SMaterial.hpp:32
@ EBF_ONE_MINUS_SRC_ALPHA
src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
Definition SMaterial.hpp:33
@ EBF_ZERO
src & dest (0, 0, 0, 0)
Definition SMaterial.hpp:26
f32 pack_textureBlendFunc(const E_BLEND_FACTOR srcFact, const E_BLEND_FACTOR dstFact, const E_MODULATE_FUNC modulate=EMFN_MODULATE_1X, const u32 alphaSource=EAS_TEXTURE)
Pack srcFact, dstFact, Modulate and alpha source to MaterialTypeParam or BlendFactor.
Definition SMaterial.hpp:119
E_MATERIAL_FLAG
Material flags.
Definition EMaterialFlags.hpp:15
@ EMF_BILINEAR_FILTER
Is bilinear filtering enabled? Default: true.
Definition EMaterialFlags.hpp:43
@ ECF_A8R8G8B8
Definition SColor.hpp:38
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
Definition EMaterialTypes.hpp:15
@ EMT_TRANSPARENT_ALPHA_CHANNEL
Makes the material transparent based on the texture alpha channel.
Definition EMaterialTypes.hpp:101
@ EMT_TRANSPARENT_ADD_COLOR
A transparent material.
Definition EMaterialTypes.hpp:88
@ EMT_ONETEXTURE_BLEND
BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
Definition EMaterialTypes.hpp:193
@ EMT_LIGHTMAP_M4
Material type with standard lightmap technique.
Definition EMaterialTypes.hpp:49
@ EMT_SOLID
Standard solid material.
Definition EMaterialTypes.hpp:19
@ ECFN_LESSEQUAL
<= test, default for e.g. depth test
Definition SMaterial.hpp:68
@ ECFN_EQUAL
Exact equality.
Definition SMaterial.hpp:70
E_MODULATE_FUNC
MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X.
Definition SMaterial.hpp:56
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
signed short s16
16 bit signed variable.
Definition irrTypes.hpp:54
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.hpp:24
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.hpp:46
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110
char c8
8 bit character variable.
Definition irrTypes.hpp:37

Jimcpp    @cppfx.xyz

K