3232 " void main() {\n " \
3333 " vec4 lighting;\n " \
3434 " vec4 color = texture2D(s_texture, v_texcoord.xy);\n " \
35+ " if(color.r + color.g + color.b + color.a == 0.0f) discard;\n " \
3536 " lighting = vec4(color.rgb * u_ambientColor.rgb * u_ambientColor.a, color.a);\n " \
3637 " lighting.rgb += u_lightColor.rgb * u_lightColor.a * color.rgb * saturate(1.0 - dot(v_normal, u_lightDir));\n " \
3738 " fragColor = lighting;\n " \
@@ -241,7 +242,7 @@ void InitHWTexturePage(CTexturePage* tpage)
241242 // FIXME: load indexes instead?
242243
243244 for (int i = 0 ; i < numDetails; i++)
244- tpage->ConvertIndexedTextureToRGBA (color_data, i, &bitmap.clut [i]);
245+ tpage->ConvertIndexedTextureToRGBA (color_data, i, &bitmap.clut [i], false , false );
245246
246247 int tpageId = tpage->GetId ();
247248
@@ -259,7 +260,7 @@ void InitHWTexturePage(CTexturePage* tpage)
259260
260261 if (detail->extraCLUTs [pal])
261262 {
262- tpage->ConvertIndexedTextureToRGBA (color_data, j, detail->extraCLUTs [pal]);
263+ tpage->ConvertIndexedTextureToRGBA (color_data, j, detail->extraCLUTs [pal], false , false );
263264 anyMatched = true ;
264265 }
265266 }
@@ -296,7 +297,7 @@ void DrawLevelDriver2(const Vector3D& cameraPos)
296297 CELL_ITERATOR ci;
297298 PACKED_CELL_OBJECT* ppco;
298299
299- int i = 441 * 2 ;
300+ int i = 441 * 32 ;
300301 int vloop = 0 ;
301302 int hloop = 0 ;
302303 int dir = 0 ;
@@ -313,7 +314,7 @@ void DrawLevelDriver2(const Vector3D& cameraPos)
313314 // walk through all cells
314315 while (i >= 0 )
315316 {
316- if (abs (hloop) + abs (vloop) < 64 )
317+ if (abs (hloop) + abs (vloop) < 256 )
317318 {
318319 // clamped vis values
319320 int vis_h = MIN (MAX (hloop, -9 ), 10 );
@@ -348,14 +349,36 @@ void DrawLevelDriver2(const Vector3D& cameraPos)
348349 continue ;
349350 }
350351
352+ ModelRef_t* ref = g_levModels.GetModelByIndex (co.type );
353+ MODEL* model = ref->model ;
354+
351355 float cellRotationRad = -co.yang / 64 .0f * PI_F * 2 .0f ;
352356
357+ bool isGround = false ;
358+
359+ if (model)
360+ {
361+ if (model->flags2 == MODEL_FLAG_TREE)
362+ {
363+ cellRotationRad = DEG2RAD (g_cameraAngles.y );
364+ }
365+
366+ if ((model->shape_flags & (SHAPE_FLAG_SUBSURFACE | SHAPE_FLAG_ALLEYWAY)) ||
367+ (model->flags2 & (MODEL_FLAG_SIDEWALK | MODEL_FLAG_GRASS)))
368+ {
369+ isGround = true ;
370+ }
371+ }
372+
353373 Vector3D absCellPosition (co.pos .vx * EXPORT_SCALING, co.pos .vy * -EXPORT_SCALING, co.pos .vz * EXPORT_SCALING);
354374 Matrix4x4 objectMatrix = translate (absCellPosition) * rotateY4 (cellRotationRad);
355375 GR_SetMatrix (MATRIX_WORLD, objectMatrix);
356376 GR_UpdateMatrixUniforms ();
357377
358- ModelRef_t* ref = g_levModels.GetModelByIndex (co.type );
378+ if (isGround)
379+ {
380+
381+ }
359382
360383 CRenderModel* renderModel = (CRenderModel*)ref->userData ;
361384
@@ -495,7 +518,7 @@ int ViewerMain(const char* filename)
495518
496519 GR_BeginScene ();
497520
498- GR_ClearColor (32 , 32 , 32 );
521+ GR_ClearColor (128 , 158 , 182 );
499522 GR_ClearDepth (1 .0f );
500523
501524 // Control and map
0 commit comments