|
1 | 1 | #include "driver_routines/models.h" |
| 2 | +#include "driver_routines/regions.h" |
2 | 3 | #include "rendermodel.h" |
3 | 4 | #include "gl_renderer.h" |
4 | 5 | #include "core/cmdlib.h" |
@@ -425,9 +426,11 @@ void CRenderModel::DrawModelCollisionBox(ModelRef_t* ref, const VECTOR_NOPAD& po |
425 | 426 | Vector3D offset = FromFixedVector(position); |
426 | 427 | Matrix4x4 world = translate(offset) * rotateY4(objRotationRad); |
427 | 428 |
|
| 429 | + MODEL* model = ref->model; |
| 430 | + |
428 | 431 | // add collision box drawing |
429 | | - int numcb = ref->model->GetCollisionBoxCount(); |
430 | | - COLLISION_PACKET* box = ref->model->pCollisionBox(0); |
| 432 | + int numcb = model->GetCollisionBoxCount(); |
| 433 | + COLLISION_PACKET* box = model->pCollisionBox(0); |
431 | 434 |
|
432 | 435 | for (int i = 0; i < numcb; i++) |
433 | 436 | { |
@@ -489,12 +492,17 @@ void CRenderModel::SetupModelShader() |
489 | 492 | GR_SetShaderConstantVector4D(g_modelShader.lightColorConstantId, g_worldRenderProperties.lightColor); |
490 | 493 | } |
491 | 494 |
|
| 495 | +extern CBaseLevelMap* g_levMap; |
| 496 | + |
492 | 497 | // sets up lighting properties |
493 | 498 | void CRenderModel::SetupLightingProperties(float ambientScale /*= 1.0f*/, float lightScale /*= 1.0f*/) |
494 | 499 | { |
495 | | - g_worldRenderProperties.ambientColor = ColorRGBA(0.95f, 0.9f, 1.0f, 0.45f * ambientScale); |
496 | | - g_worldRenderProperties.lightColor = ColorRGBA(1.0f, 1.0f, 1.0f, 0.4f * lightScale); |
497 | | - g_worldRenderProperties.lightDir = normalize(Vector3D(1, -0.5, 0)); |
| 500 | + Vector3D lightVector = normalize(FromFixedVector(g_levMap->GetMapInfo().light_source)); |
| 501 | +; float lightLevel = g_levMap->GetMapInfo().ambient_light_level / ONE_F; |
| 502 | + |
| 503 | + g_worldRenderProperties.ambientColor = ColorRGBA(0.95f, 0.9f, 1.0f, 0.8f * ambientScale * lightLevel); |
| 504 | + g_worldRenderProperties.lightColor = ColorRGBA(1.0f, 1.0f, 1.0f, 0.8f * lightScale * lightLevel); |
| 505 | + g_worldRenderProperties.lightDir = lightVector * Vector3D(1,-1,1); |
498 | 506 | } |
499 | 507 |
|
500 | 508 | //---------------------------------------- |
|
0 commit comments