|
@@ -28,32 +28,7 @@
|
28
|
28
|
#include "Render.h"
|
29
|
29
|
#include "utils/strings.h"
|
30
|
30
|
|
31
|
|
-bool compareEntites(const void *voidA, const void *voidB)
|
32
|
|
-{
|
33
|
|
- entity_t *a = (entity_t *)voidA, *b = (entity_t *)voidB;
|
34
|
|
- vec_t distA, distB;
|
35
|
|
-
|
36
|
|
- if (!a || !b)
|
37
|
|
- return false; // error really
|
38
|
|
-
|
39
|
|
- distA = getRender().mViewVolume.getDistToSphereFromNear(a->pos[0],
|
40
|
|
- a->pos[1],
|
41
|
|
- a->pos[2],
|
42
|
|
- 1.0f);
|
43
|
|
- distB = getRender().mViewVolume.getDistToSphereFromNear(b->pos[0],
|
44
|
|
- b->pos[1],
|
45
|
|
- b->pos[2],
|
46
|
|
- 1.0f);
|
47
|
|
-
|
48
|
|
- return (distA < distB);
|
49
|
|
-}
|
50
|
|
-
|
51
|
|
-////////////////////////////////////////////////////////////
|
52
|
|
-// Constructors
|
53
|
|
-////////////////////////////////////////////////////////////
|
54
|
|
-
|
55
|
|
-Render::Render()
|
56
|
|
-{
|
|
31
|
+Render::Render() {
|
57
|
32
|
mSkyMesh = -1;
|
58
|
33
|
mSkyMeshRotation = false;
|
59
|
34
|
mMode = Render::modeDisabled;
|
|
@@ -64,16 +39,11 @@ Render::Render()
|
64
|
39
|
}
|
65
|
40
|
|
66
|
41
|
|
67
|
|
-Render::~Render()
|
68
|
|
-{
|
|
42
|
+Render::~Render() {
|
69
|
43
|
ClearWorld();
|
70
|
44
|
}
|
71
|
45
|
|
72
|
46
|
|
73
|
|
-////////////////////////////////////////////////////////////
|
74
|
|
-// Public Accessors
|
75
|
|
-////////////////////////////////////////////////////////////
|
76
|
|
-
|
77
|
47
|
void Render::screenShot(char *filenameBase)
|
78
|
48
|
{
|
79
|
49
|
mTexture.glScreenShot(filenameBase, getWindow().mWidth, getWindow().mHeight);
|
|
@@ -83,10 +53,6 @@ unsigned int Render::getFlags() {
|
83
|
53
|
return mFlags;
|
84
|
54
|
}
|
85
|
55
|
|
86
|
|
-////////////////////////////////////////////////////////////
|
87
|
|
-// Public Mutators
|
88
|
|
-////////////////////////////////////////////////////////////
|
89
|
|
-
|
90
|
56
|
|
91
|
57
|
void Render::loadTexture(unsigned char *image,
|
92
|
58
|
unsigned int width, unsigned int height,
|
|
@@ -128,12 +94,6 @@ int Render::initTextures(char *textureDir) {
|
128
|
94
|
|
129
|
95
|
void Render::ClearWorld() {
|
130
|
96
|
mRoomRenderList.clear();
|
131
|
|
-
|
132
|
|
- for (unsigned int i = 0; i < mModels.size(); i++) {
|
133
|
|
- if (mModels[i])
|
134
|
|
- delete mModels[i];
|
135
|
|
- }
|
136
|
|
- mModels.clear();
|
137
|
97
|
}
|
138
|
98
|
|
139
|
99
|
|
|
@@ -235,8 +195,7 @@ void lightRoom(Room &room)
|
235
|
195
|
|
236
|
196
|
void Render::clearFlags(unsigned int flags)
|
237
|
197
|
{
|
238
|
|
- // _defaults |= flags; // Force removal if it wasn't set
|
239
|
|
- mFlags ^= flags;
|
|
198
|
+ mFlags &= ~flags;
|
240
|
199
|
|
241
|
200
|
if (flags & Render::fFog)
|
242
|
201
|
{
|
|
@@ -354,11 +313,6 @@ void gluLookAt(float eyeX, float eyeY, float eyeZ,
|
354
|
313
|
|
355
|
314
|
void Render::display()
|
356
|
315
|
{
|
357
|
|
- vec3_t curPos;
|
358
|
|
- vec3_t camPos;
|
359
|
|
- vec3_t atPos;
|
360
|
|
- int index;
|
361
|
|
-
|
362
|
316
|
switch (mMode)
|
363
|
317
|
{
|
364
|
318
|
case Render::modeDisabled:
|
|
@@ -368,7 +322,7 @@ void Render::display()
|
368
|
322
|
drawLoadScreen();
|
369
|
323
|
return;
|
370
|
324
|
default:
|
371
|
|
- ;
|
|
325
|
+ break;
|
372
|
326
|
}
|
373
|
327
|
|
374
|
328
|
if (mMode == Render::modeWireframe)
|
|
@@ -376,101 +330,58 @@ void Render::display()
|
376
|
330
|
else
|
377
|
331
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
378
|
332
|
|
379
|
|
- index = -1;
|
|
333
|
+ float camOffsetH = 0.0f;
|
380
|
334
|
|
381
|
|
- if (getGame().mLara)
|
|
335
|
+ switch (getGame().getLara().getMoveType())
|
382
|
336
|
{
|
383
|
|
- float yaw;
|
384
|
|
- int sector;
|
385
|
|
- float camOffsetH = 0.0f;
|
386
|
|
-
|
387
|
|
-
|
388
|
|
- switch (getGame().mLara->moveType)
|
389
|
|
- {
|
390
|
|
- case worldMoveType_fly:
|
391
|
|
- case worldMoveType_noClipping:
|
392
|
|
- case worldMoveType_swim:
|
393
|
|
- camOffsetH = 64.0f;
|
394
|
|
- break;
|
395
|
|
- case worldMoveType_walk:
|
396
|
|
- case worldMoveType_walkNoSwim:
|
397
|
|
- camOffsetH = 512.0f;
|
398
|
|
- break;
|
399
|
|
- }
|
400
|
|
-
|
401
|
|
- curPos[0] = getGame().mLara->pos[0];
|
402
|
|
- curPos[1] = getGame().mLara->pos[1];
|
403
|
|
- curPos[2] = getGame().mLara->pos[2];
|
404
|
|
- yaw = getGame().mLara->angles[1];
|
405
|
|
-
|
406
|
|
- index = getGame().mLara->room;
|
|
337
|
+ case Entity::MoveTypeFly:
|
|
338
|
+ case Entity::MoveTypeNoClipping:
|
|
339
|
+ case Entity::MoveTypeSwim:
|
|
340
|
+ camOffsetH = 64.0f;
|
|
341
|
+ break;
|
|
342
|
+ case Entity::MoveTypeWalk:
|
|
343
|
+ case Entity::MoveTypeWalkNoSwim:
|
|
344
|
+ camOffsetH = 512.0f;
|
|
345
|
+ break;
|
|
346
|
+ }
|
407
|
347
|
|
408
|
|
- // Mongoose 2002.08.24, New 3rd person camera hack
|
409
|
|
- camPos[0] = curPos[0];
|
410
|
|
- camPos[1] = curPos[1] - camOffsetH; // UP is lower val
|
411
|
|
- camPos[2] = curPos[2];
|
|
348
|
+ vec3_t curPos;
|
|
349
|
+ vec3_t camPos;
|
|
350
|
+ vec3_t atPos;
|
412
|
351
|
|
413
|
|
- camPos[0] -= (1024.0f * sinf(yaw));
|
414
|
|
- camPos[2] -= (1024.0f * cosf(yaw));
|
|
352
|
+ curPos[0] = getGame().getLara().getPos(0);
|
|
353
|
+ curPos[1] = getGame().getLara().getPos(1);
|
|
354
|
+ curPos[2] = getGame().getLara().getPos(2);
|
|
355
|
+ vec_t yaw = getGame().getLara().getAngle(1);
|
415
|
356
|
|
416
|
|
- sector = getWorld().getSector(index, camPos[0], camPos[2]);
|
|
357
|
+ // Mongoose 2002.08.24, New 3rd person camera hack
|
|
358
|
+ camPos[0] = curPos[0] - (1024.0f * sinf(yaw));
|
|
359
|
+ camPos[1] = curPos[1] - camOffsetH; // UP is lower val
|
|
360
|
+ camPos[2] = curPos[2] - (1024.0f * cosf(yaw));
|
417
|
361
|
|
418
|
|
- // Handle camera out of world
|
419
|
|
- if (sector < 0 || getWorld().isWall(index, sector))
|
420
|
|
- {
|
421
|
|
- camPos[0] = curPos[0] + (64.0f * sinf(yaw));
|
422
|
|
- camPos[1] -= 64.0f;
|
423
|
|
- camPos[2] = curPos[2] + (64.0f * cosf(yaw));
|
424
|
|
- }
|
|
362
|
+ int index = getGame().getLara().getRoom();
|
|
363
|
+ int sector = getWorld().getSector(index, camPos[0], camPos[2]);
|
425
|
364
|
|
426
|
|
- getCamera().setPosition(camPos);
|
|
365
|
+ // Handle camera out of world
|
|
366
|
+ if (sector < 0 || getWorld().isWall(index, sector)) {
|
|
367
|
+ camPos[0] = curPos[0] + (64.0f * sinf(yaw));
|
|
368
|
+ camPos[1] -= 64.0f;
|
|
369
|
+ camPos[2] = curPos[2] + (64.0f * cosf(yaw));
|
427
|
370
|
}
|
428
|
371
|
|
429
|
372
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
430
|
373
|
glLoadIdentity();
|
431
|
374
|
|
432
|
375
|
// Setup view in OpenGL with camera
|
|
376
|
+ getCamera().setPosition(camPos);
|
433
|
377
|
getCamera().update();
|
434
|
|
- getCamera().getPosition(camPos);
|
435
|
378
|
getCamera().getTarget(atPos);
|
436
|
379
|
// Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
|
437
|
|
-
|
438
|
380
|
gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0f, -1.0f, 0.0f);
|
439
|
381
|
|
440
|
382
|
// Update view volume for vising
|
441
|
383
|
updateViewVolume();
|
442
|
384
|
|
443
|
|
- // Let's see the LoS -- should be event controled
|
444
|
|
- if (getGame().mLara)
|
445
|
|
- {
|
446
|
|
- // SkeletalModel *mdl = getGame().mLara->tmpHook;
|
447
|
|
-
|
448
|
|
- // Draw in solid colors
|
449
|
|
- glDisable(GL_TEXTURE_2D);
|
450
|
|
- glDisable(GL_CULL_FACE);
|
451
|
|
-
|
452
|
|
- if (getGame().mLara->state == 64) // eWeaponFire
|
453
|
|
- {
|
454
|
|
- vec3_t u, v; //, s, t;
|
455
|
|
-
|
456
|
|
- // Center of getGame().mLara
|
457
|
|
- u[0] = curPos[0];
|
458
|
|
- u[1] = curPos[1] - 512.0f;
|
459
|
|
- u[2] = curPos[2];
|
460
|
|
-
|
461
|
|
- // Location getGame().mLara is aiming at? ( Not finished yet )
|
462
|
|
- v[0] = u[0] + (9000.0f * sinf(getGame().mLara->angles[1]));
|
463
|
|
- v[1] = u[1] + (9000.0f * sinf(getGame().mLara->angles[2]));
|
464
|
|
- v[2] = u[2] + (9000.0f * cosf(getGame().mLara->angles[1]));
|
465
|
|
-
|
466
|
|
- // Test tracing of aim
|
467
|
|
- renderTrace(0, u, v); // v = target
|
468
|
|
- }
|
469
|
|
-
|
470
|
|
- glEnable(GL_CULL_FACE);
|
471
|
|
- glEnable(GL_TEXTURE_2D);
|
472
|
|
- }
|
473
|
|
-
|
474
|
385
|
// Render world
|
475
|
386
|
glColor3fv(DIM_WHITE); // was WHITE
|
476
|
387
|
drawSkyMesh(96.0);
|
|
@@ -479,43 +390,33 @@ void Render::display()
|
479
|
390
|
newRoomRenderList(index);
|
480
|
391
|
|
481
|
392
|
// Room solid pass, need to do depth sorting to avoid 2 pass render
|
482
|
|
- for (unsigned int i = 0; i < mRoomRenderList.size(); i++)
|
483
|
|
- {
|
|
393
|
+ for (unsigned int i = 0; i < mRoomRenderList.size(); i++) {
|
484
|
394
|
Room &room = *mRoomRenderList[i];
|
485
|
395
|
|
486
|
396
|
if (mFlags & Render::fGL_Lights)
|
487
|
|
- {
|
488
|
397
|
lightRoom(room);
|
489
|
|
- }
|
490
|
398
|
|
491
|
399
|
room.display(false);
|
492
|
400
|
}
|
493
|
401
|
|
494
|
402
|
// Draw all visible enities
|
495
|
|
- if (mFlags & Render::fEntityModels)
|
496
|
|
- {
|
497
|
|
- entity_t *e;
|
498
|
|
- std::vector<entity_t *> entityRenderList;
|
499
|
|
- std::vector<entity_t *> *entities = getWorld().getEntities();
|
|
403
|
+ if (mFlags & Render::fEntityModels) {
|
|
404
|
+ std::vector<Entity *> entityRenderList;
|
500
|
405
|
|
501
|
|
- for (unsigned int i = 0; i < entities->size(); i++)
|
502
|
|
- {
|
503
|
|
- e = entities->at(i);
|
|
406
|
+ for (unsigned int i = 0; i < getWorld().sizeEntity(); i++) {
|
|
407
|
+ Entity &e = getWorld().getEntity(i);
|
504
|
408
|
|
505
|
|
- // Mongoose 2002.03.26, Don't show lara to it's own player
|
506
|
|
- if (!e || e == getGame().mLara)
|
507
|
|
- {
|
|
409
|
+ // Don't show Lara to the player
|
|
410
|
+ if (&e == &getGame().getLara())
|
508
|
411
|
continue;
|
509
|
|
- }
|
510
|
412
|
|
511
|
413
|
// Mongoose 2002.08.15, Nothing to draw, skip
|
512
|
|
- // Mongoose 2002.12.24, Some entities have no animation =p
|
513
|
|
- if (e->tmpHook)
|
514
|
|
- if (e->tmpHook->model->animation.empty())
|
|
414
|
+ // Mongoose 2002.12.24, Some entities have no animation =p
|
|
415
|
+ if (e.getModel().size() == 0)
|
515
|
416
|
continue;
|
516
|
417
|
|
517
|
418
|
// Is it in view volume? ( Hack to use sphere )
|
518
|
|
- if (!isVisible(e->pos[0], e->pos[1], e->pos[2], 512.0f))
|
|
419
|
+ if (!isVisible(e.getPos(0), e.getPos(1), e.getPos(2), 512.0f))
|
519
|
420
|
continue;
|
520
|
421
|
|
521
|
422
|
//! \fixme Is it in a room we're rendering?
|
|
@@ -524,7 +425,7 @@ void Render::display()
|
524
|
425
|
// continue;
|
525
|
426
|
//}
|
526
|
427
|
|
527
|
|
- entityRenderList.push_back(e);
|
|
428
|
+ entityRenderList.push_back(&e);
|
528
|
429
|
}
|
529
|
430
|
|
530
|
431
|
// Draw objects not tied to rooms
|
|
@@ -533,28 +434,18 @@ void Render::display()
|
533
|
434
|
glPopMatrix();
|
534
|
435
|
|
535
|
436
|
// Depth sort entityRenderList with qsort
|
536
|
|
- std::sort(entityRenderList.begin(), entityRenderList.end(), compareEntites);
|
537
|
|
-
|
538
|
|
- for (unsigned int i = 0; i < entityRenderList.size(); i++)
|
539
|
|
- {
|
540
|
|
- e = entityRenderList[i];
|
|
437
|
+ std::sort(entityRenderList.begin(), entityRenderList.end());
|
541
|
438
|
|
542
|
|
- glPushMatrix();
|
543
|
|
- glTranslatef(e->pos[0], e->pos[1], e->pos[2]);
|
544
|
|
- glRotatef(e->angles[1], 0, 1, 0);
|
545
|
|
- drawModel(e->tmpHook);
|
546
|
|
- glPopMatrix();
|
|
439
|
+ for (unsigned int i = 0; i < entityRenderList.size(); i++) {
|
|
440
|
+ entityRenderList[i]->display();
|
547
|
441
|
}
|
548
|
442
|
}
|
549
|
443
|
|
550
|
444
|
// Room alpha pass
|
551
|
445
|
// Skip room alpha pass for modes w/o texture
|
552
|
|
- if (!(mMode == Render::modeSolid || mMode == Render::modeWireframe))
|
553
|
|
- {
|
|
446
|
+ if (!(mMode == Render::modeSolid || mMode == Render::modeWireframe)) {
|
554
|
447
|
for (unsigned int i = 0; i < mRoomRenderList.size(); i++)
|
555
|
|
- {
|
556
|
448
|
mRoomRenderList[i]->display(true);
|
557
|
|
- }
|
558
|
449
|
}
|
559
|
450
|
|
560
|
451
|
if (mMode == Render::modeWireframe)
|
|
@@ -711,11 +602,9 @@ void Render::buildRoomRenderList(Room &room)
|
711
|
602
|
|
712
|
603
|
void Render::drawSkyMesh(float scale)
|
713
|
604
|
{
|
714
|
|
- skeletal_model_t *model = getWorld().getModel(mSkyMesh);
|
715
|
|
-
|
716
|
|
-
|
717
|
|
- if (!model)
|
718
|
|
- return;
|
|
605
|
+ //skeletal_model_t *model = getWorld().getModel(mSkyMesh);
|
|
606
|
+ //if (!model)
|
|
607
|
+ // return;
|
719
|
608
|
|
720
|
609
|
glDisable(GL_DEPTH_TEST);
|
721
|
610
|
glPushMatrix();
|
|
@@ -734,21 +623,12 @@ void Render::drawSkyMesh(float scale)
|
734
|
623
|
}
|
735
|
624
|
|
736
|
625
|
|
737
|
|
-void Render::drawObjects()
|
738
|
|
-{
|
|
626
|
+void Render::drawObjects() {
|
739
|
627
|
// Draw lara or other player model ( move to entity rendering method )
|
740
|
|
- if (mFlags & Render::fViewModel && getGame().mLara && getGame().mLara->tmpHook)
|
741
|
|
- {
|
742
|
|
- glPushMatrix();
|
743
|
|
-
|
744
|
|
- glTranslated(getGame().mLara->pos[0], getGame().mLara->pos[1], getGame().mLara->pos[2]);
|
745
|
|
- glRotated(OR_RAD_TO_DEG(getCamera().getRadianYaw()), 0, 1, 0);
|
|
628
|
+ if (mFlags & Render::fViewModel)
|
|
629
|
+ getGame().getLara().display();
|
746
|
630
|
|
747
|
|
- drawModel(getGame().mLara->tmpHook);
|
748
|
|
- glPopMatrix();
|
749
|
|
- }
|
750
|
|
-
|
751
|
|
- // Mongoose 2002.03.22, Draw sprites after player to handle alpha
|
|
631
|
+ // Draw sprites after player to handle alpha
|
752
|
632
|
for (unsigned int i = 0; i < getWorld().sizeSprite(); i++) {
|
753
|
633
|
SpriteSequence &sprite = getWorld().getSprite(i);
|
754
|
634
|
for (unsigned int j = 0; j < sprite.size(); j++)
|
|
@@ -757,189 +637,6 @@ void Render::drawObjects()
|
757
|
637
|
}
|
758
|
638
|
|
759
|
639
|
|
760
|
|
-void Render::drawModel(SkeletalModel *model)
|
761
|
|
-{
|
762
|
|
- animation_frame_t *animation;
|
763
|
|
- bone_frame_t *boneframe;
|
764
|
|
- bone_frame_t *boneframe2 = 0x0;
|
765
|
|
- bone_tag_t *tag;
|
766
|
|
- bone_tag_t *tag2;
|
767
|
|
- int bframe, aframe;
|
768
|
|
- skeletal_model_t *mdl;
|
769
|
|
-
|
770
|
|
-
|
771
|
|
- if (!model || !model->model)
|
772
|
|
- return;
|
773
|
|
-
|
774
|
|
- mdl = model->model;
|
775
|
|
- aframe = model->getAnimation();
|
776
|
|
- bframe = model->getFrame();
|
777
|
|
- animation = mdl->animation[aframe];
|
778
|
|
-
|
779
|
|
- if (!animation)
|
780
|
|
- {
|
781
|
|
-#ifdef DEBUG
|
782
|
|
- printf("ERROR: No animation for model[%i].aframe[%i] %lu\n",
|
783
|
|
- mdl->id, aframe, mdl->animation.size());
|
784
|
|
-#endif
|
785
|
|
- return;
|
786
|
|
- }
|
787
|
|
-
|
788
|
|
- if (animation->frame.empty())
|
789
|
|
- {
|
790
|
|
-#ifdef DEBUG
|
791
|
|
- printf("ERROR: No boneframes?!?! *** %i:%i ***\n",
|
792
|
|
- mdl->id, bframe);
|
793
|
|
-#endif
|
794
|
|
- return;
|
795
|
|
- }
|
796
|
|
-
|
797
|
|
- boneframe = animation->frame[bframe];
|
798
|
|
-
|
799
|
|
- if (!boneframe)
|
800
|
|
- return;
|
801
|
|
-
|
802
|
|
- if (boneframe->tag.empty())
|
803
|
|
- {
|
804
|
|
- printf("Empty bone frame?!?!\n");
|
805
|
|
- return;
|
806
|
|
- }
|
807
|
|
-
|
808
|
|
- glTranslatef(boneframe->pos[0], boneframe->pos[1], boneframe->pos[2]);
|
809
|
|
-
|
810
|
|
- for (unsigned int a = 0; a < boneframe->tag.size(); a++)
|
811
|
|
- {
|
812
|
|
- tag = boneframe->tag[a];
|
813
|
|
-
|
814
|
|
- if (!tag)
|
815
|
|
- continue;
|
816
|
|
-
|
817
|
|
- if (a == 0)
|
818
|
|
- {
|
819
|
|
- if (!equalEpsilon(tag->rot[1], 0.0f)) // was just if (tag->rot[1])
|
820
|
|
- glRotatef(tag->rot[1], 0, 1, 0);
|
821
|
|
-
|
822
|
|
- if (!equalEpsilon(tag->rot[0], 0.0f))
|
823
|
|
- glRotatef(tag->rot[0], 1, 0, 0);
|
824
|
|
-
|
825
|
|
- if (!equalEpsilon(tag->rot[2], 0.0f))
|
826
|
|
- glRotatef(tag->rot[2], 0, 0, 1);
|
827
|
|
- }
|
828
|
|
- else
|
829
|
|
- {
|
830
|
|
- if (tag->flag & 0x01)
|
831
|
|
- glPopMatrix();
|
832
|
|
-
|
833
|
|
- if (tag->flag & 0x02)
|
834
|
|
- glPushMatrix();
|
835
|
|
-
|
836
|
|
- glTranslatef(tag->off[0], tag->off[1], tag->off[2]);
|
837
|
|
-
|
838
|
|
- if (!equalEpsilon(tag->rot[1], 0.0f))
|
839
|
|
- glRotatef(tag->rot[1], 0, 1, 0);
|
840
|
|
-
|
841
|
|
- if (!equalEpsilon(tag->rot[0], 0.0f))
|
842
|
|
- glRotatef(tag->rot[0], 1, 0, 0);
|
843
|
|
-
|
844
|
|
- if (!equalEpsilon(tag->rot[2], 0.0f))
|
845
|
|
- glRotatef(tag->rot[2], 0, 0, 1);
|
846
|
|
- }
|
847
|
|
-
|
848
|
|
- // Draw layered lara in TR4 ( 2 meshes per tag )
|
849
|
|
- if (mdl->tr4Overlay == 1)
|
850
|
|
- {
|
851
|
|
- boneframe2 = (mdl->animation[0])->frame[0];
|
852
|
|
-
|
853
|
|
- if (boneframe2)
|
854
|
|
- {
|
855
|
|
- tag2 = boneframe2->tag[a];
|
856
|
|
-
|
857
|
|
- if (tag2)
|
858
|
|
- {
|
859
|
|
- drawModelMesh(getWorld().getMesh(tag2->mesh));
|
860
|
|
- }
|
861
|
|
- }
|
862
|
|
- }
|
863
|
|
-
|
864
|
|
- if (mFlags & Render::fRenderPonytail)
|
865
|
|
- {
|
866
|
|
- if (mdl->ponytailId > 0 &&
|
867
|
|
- a == 14)
|
868
|
|
- {
|
869
|
|
- glPushMatrix();
|
870
|
|
-
|
871
|
|
- // Mongoose 2002.08.30, TEST to align offset
|
872
|
|
- glTranslatef(mdl->ponytail[0], mdl->ponytail[1], mdl->ponytail[2]);
|
873
|
|
- glRotatef(mdl->ponytailAngle, 1, 0, 0);
|
874
|
|
-
|
875
|
|
- // HACK: To fill TR4 void between ponytail/head
|
876
|
|
- // since no vertex welds are implemented yet
|
877
|
|
- if (mdl->tr4Overlay == 1)
|
878
|
|
- {
|
879
|
|
- glScalef(1.20f, 1.20f, 1.20f);
|
880
|
|
- }
|
881
|
|
-
|
882
|
|
-#ifdef EXPERIMENTAL_NON_ITEM_RENDER
|
883
|
|
- drawModel(mModels[mdl->ponytail], 0, 0);
|
884
|
|
-#else
|
885
|
|
- for (unsigned int i = 0; i < mdl->ponytailNumMeshes; ++i)
|
886
|
|
- {
|
887
|
|
- glPushMatrix();
|
888
|
|
-
|
889
|
|
- if (i > 0)
|
890
|
|
- {
|
891
|
|
- glRotatef(randomNum(-8.0f, -10.0f), 1, 0, 0);
|
892
|
|
- glRotatef(randomNum(-5.0f, 5.0f), 0, 1, 0);
|
893
|
|
- glRotatef(randomNum(-5.0f, 5.0f), 0, 0, 1);
|
894
|
|
-
|
895
|
|
- glTranslatef(0.0, 0.0, mdl->ponyOff);
|
896
|
|
- }
|
897
|
|
-
|
898
|
|
- if (mdl->pigtails)
|
899
|
|
- {
|
900
|
|
- glPushMatrix();
|
901
|
|
- glTranslatef(mdl->ponyOff2, 0.0, 0.0);
|
902
|
|
- drawModelMesh(getWorld().getMesh(mdl->ponytailMeshId + i));
|
903
|
|
- glPopMatrix();
|
904
|
|
-
|
905
|
|
- glPushMatrix();
|
906
|
|
- glTranslatef(-mdl->ponyOff2, 0.0, 0.0);
|
907
|
|
- drawModelMesh(getWorld().getMesh(mdl->ponytailMeshId + i));
|
908
|
|
- glPopMatrix();
|
909
|
|
- }
|
910
|
|
- else
|
911
|
|
- {
|
912
|
|
- drawModelMesh(getWorld().getMesh(mdl->ponytailMeshId + i));
|
913
|
|
- }
|
914
|
|
- }
|
915
|
|
-
|
916
|
|
- for (unsigned int i = 0; i < mdl->ponytailNumMeshes; ++i)
|
917
|
|
- {
|
918
|
|
- glPopMatrix();
|
919
|
|
- }
|
920
|
|
-#endif
|
921
|
|
- glPopMatrix();
|
922
|
|
- }
|
923
|
|
- }
|
924
|
|
-
|
925
|
|
- drawModelMesh(getWorld().getMesh(tag->mesh));
|
926
|
|
- }
|
927
|
|
-
|
928
|
|
- // Cycle frames ( cheap hack from old ent state based system )
|
929
|
|
- if (mFlags & fAnimateAllModels)
|
930
|
|
- {
|
931
|
|
- if (model->getFrame() + 1 > (int)animation->frame.size()-1)
|
932
|
|
- {
|
933
|
|
- model->setFrame(0);
|
934
|
|
- }
|
935
|
|
- else
|
936
|
|
- {
|
937
|
|
- model->setFrame(model->getFrame()+1);
|
938
|
|
- }
|
939
|
|
- }
|
940
|
|
-}
|
941
|
|
-
|
942
|
|
-
|
943
|
640
|
void Render::tmpRenderModelMesh(model_mesh_t *r_mesh, texture_tri_t *ttri)
|
944
|
641
|
{
|
945
|
642
|
glBegin(GL_TRIANGLES);
|
|
@@ -1111,12 +808,6 @@ void Render::setSkyMesh(int index, bool rot)
|
1111
|
808
|
}
|
1112
|
809
|
|
1113
|
810
|
|
1114
|
|
-void Render::addSkeletalModel(SkeletalModel *mdl)
|
1115
|
|
-{
|
1116
|
|
- mModels.push_back(mdl);
|
1117
|
|
-}
|
1118
|
|
-
|
1119
|
|
-
|
1120
|
811
|
void Render::updateViewVolume()
|
1121
|
812
|
{
|
1122
|
813
|
matrix_t proj;
|
|
@@ -1131,9 +822,11 @@ void Render::updateViewVolume()
|
1131
|
822
|
bool Render::isVisible(BoundingBox &box) {
|
1132
|
823
|
vec3_t bbox[2];
|
1133
|
824
|
box.getBoundingBox(bbox);
|
|
825
|
+
|
1134
|
826
|
// For debugging purposes
|
1135
|
827
|
if (mMode == Render::modeWireframe)
|
1136
|
828
|
box.display(true, PINK, RED);
|
|
829
|
+
|
1137
|
830
|
return mViewVolume.isBboxInFrustum(bbox[0], bbox[1]);
|
1138
|
831
|
}
|
1139
|
832
|
|