@@ -290,83 +290,6 @@ void Sky::render()
290
290
driver->drawIndexedTriangleFan (&vertices[0 ], 4 , indices, 2 );
291
291
}
292
292
293
- // Draw stars
294
- do {
295
- driver->setMaterial (m_materials[1 ]);
296
- float starbrightness = MYMAX (0 , MYMIN (1 ,
297
- (0.285 - fabs (wicked_time_of_day < 0.5 ?
298
- wicked_time_of_day : (1.0 - wicked_time_of_day))) * 10 ));
299
- float f = starbrightness;
300
- float d = 0.007 /2 ;
301
- video::SColor starcolor (255 , f * 90 , f * 90 , f * 90 );
302
- if (starcolor.getBlue () < m_skycolor.getBlue ())
303
- break ;
304
- #ifdef __ANDROID__
305
- u16 indices[SKY_STAR_COUNT * 3 ];
306
- video::S3DVertex vertices[SKY_STAR_COUNT * 3 ];
307
- for (u32 i = 0 ; i < SKY_STAR_COUNT; i++) {
308
- indices[i * 3 + 0 ] = i * 3 + 0 ;
309
- indices[i * 3 + 1 ] = i * 3 + 1 ;
310
- indices[i * 3 + 2 ] = i * 3 + 2 ;
311
- v3f r = m_stars[i];
312
- core::CMatrix4<f32> a;
313
- a.buildRotateFromTo (v3f (0 , 1 , 0 ), r);
314
- v3f p = v3f (-d, 1 , -d);
315
- v3f p1 = v3f (d, 1 , 0 );
316
- v3f p2 = v3f (-d, 1 , d);
317
- a.rotateVect (p);
318
- a.rotateVect (p1);
319
- a.rotateVect (p2);
320
- p.rotateXYBy (wicked_time_of_day * 360 - 90 );
321
- p1.rotateXYBy (wicked_time_of_day * 360 - 90 );
322
- p2.rotateXYBy (wicked_time_of_day * 360 - 90 );
323
- vertices[i * 3 + 0 ].Pos = p;
324
- vertices[i * 3 + 0 ].Color = starcolor;
325
- vertices[i * 3 + 1 ].Pos = p1;
326
- vertices[i * 3 + 1 ].Color = starcolor;
327
- vertices[i * 3 + 2 ].Pos = p2;
328
- vertices[i * 3 + 2 ].Color = starcolor;
329
- }
330
- driver->drawIndexedTriangleList (vertices, SKY_STAR_COUNT * 3 ,
331
- indices, SKY_STAR_COUNT);
332
- #else
333
- u16 indices[SKY_STAR_COUNT * 4 ];
334
- video::S3DVertex vertices[SKY_STAR_COUNT * 4 ];
335
- for (u32 i = 0 ; i < SKY_STAR_COUNT; i++) {
336
- indices[i * 4 + 0 ] = i * 4 + 0 ;
337
- indices[i * 4 + 1 ] = i * 4 + 1 ;
338
- indices[i * 4 + 2 ] = i * 4 + 2 ;
339
- indices[i * 4 + 3 ] = i * 4 + 3 ;
340
- v3f r = m_stars[i];
341
- core::CMatrix4<f32> a;
342
- a.buildRotateFromTo (v3f (0 , 1 , 0 ), r);
343
- v3f p = v3f (-d, 1 , -d);
344
- v3f p1 = v3f ( d, 1 , -d);
345
- v3f p2 = v3f ( d, 1 , d);
346
- v3f p3 = v3f (-d, 1 , d);
347
- a.rotateVect (p);
348
- a.rotateVect (p1);
349
- a.rotateVect (p2);
350
- a.rotateVect (p3);
351
- p.rotateXYBy (wicked_time_of_day * 360 - 90 );
352
- p1.rotateXYBy (wicked_time_of_day * 360 - 90 );
353
- p2.rotateXYBy (wicked_time_of_day * 360 - 90 );
354
- p3.rotateXYBy (wicked_time_of_day * 360 - 90 );
355
- vertices[i * 4 + 0 ].Pos = p;
356
- vertices[i * 4 + 0 ].Color = starcolor;
357
- vertices[i * 4 + 1 ].Pos = p1;
358
- vertices[i * 4 + 1 ].Color = starcolor;
359
- vertices[i * 4 + 2 ].Pos = p2;
360
- vertices[i * 4 + 2 ].Color = starcolor;
361
- vertices[i * 4 + 3 ].Pos = p3;
362
- vertices[i * 4 + 3 ].Color = starcolor;
363
- }
364
- driver->drawVertexPrimitiveList (vertices, SKY_STAR_COUNT * 4 ,
365
- indices, SKY_STAR_COUNT, video::EVT_STANDARD,
366
- scene::EPT_QUADS, video::EIT_16BIT);
367
- #endif
368
- } while (false );
369
-
370
293
// Draw sun
371
294
if (wicked_time_of_day > 0.15 && wicked_time_of_day < 0.85 ) {
372
295
if (!m_sun_texture) {
@@ -519,6 +442,83 @@ void Sky::render()
519
442
}
520
443
}
521
444
445
+ // Draw stars
446
+ do {
447
+ driver->setMaterial (m_materials[1 ]);
448
+ float starbrightness = MYMAX (0 , MYMIN (1 ,
449
+ (0.285 - fabs (wicked_time_of_day < 0.5 ?
450
+ wicked_time_of_day : (1.0 - wicked_time_of_day))) * 10 ));
451
+ float f = starbrightness;
452
+ float d = 0.007 /2 ;
453
+ video::SColor starcolor (255 , f * 90 , f * 90 , f * 90 );
454
+ if (starcolor.getBlue () < m_skycolor.getBlue ())
455
+ break ;
456
+ #ifdef __ANDROID__
457
+ u16 indices[SKY_STAR_COUNT * 3 ];
458
+ video::S3DVertex vertices[SKY_STAR_COUNT * 3 ];
459
+ for (u32 i = 0 ; i < SKY_STAR_COUNT; i++) {
460
+ indices[i * 3 + 0 ] = i * 3 + 0 ;
461
+ indices[i * 3 + 1 ] = i * 3 + 1 ;
462
+ indices[i * 3 + 2 ] = i * 3 + 2 ;
463
+ v3f r = m_stars[i];
464
+ core::CMatrix4<f32> a;
465
+ a.buildRotateFromTo (v3f (0 , 1 , 0 ), r);
466
+ v3f p = v3f (-d, 1 , -d);
467
+ v3f p1 = v3f (d, 1 , 0 );
468
+ v3f p2 = v3f (-d, 1 , d);
469
+ a.rotateVect (p);
470
+ a.rotateVect (p1);
471
+ a.rotateVect (p2);
472
+ p.rotateXYBy (wicked_time_of_day * 360 - 90 );
473
+ p1.rotateXYBy (wicked_time_of_day * 360 - 90 );
474
+ p2.rotateXYBy (wicked_time_of_day * 360 - 90 );
475
+ vertices[i * 3 + 0 ].Pos = p;
476
+ vertices[i * 3 + 0 ].Color = starcolor;
477
+ vertices[i * 3 + 1 ].Pos = p1;
478
+ vertices[i * 3 + 1 ].Color = starcolor;
479
+ vertices[i * 3 + 2 ].Pos = p2;
480
+ vertices[i * 3 + 2 ].Color = starcolor;
481
+ }
482
+ driver->drawIndexedTriangleList (vertices, SKY_STAR_COUNT * 3 ,
483
+ indices, SKY_STAR_COUNT);
484
+ #else
485
+ u16 indices[SKY_STAR_COUNT * 4 ];
486
+ video::S3DVertex vertices[SKY_STAR_COUNT * 4 ];
487
+ for (u32 i = 0 ; i < SKY_STAR_COUNT; i++) {
488
+ indices[i * 4 + 0 ] = i * 4 + 0 ;
489
+ indices[i * 4 + 1 ] = i * 4 + 1 ;
490
+ indices[i * 4 + 2 ] = i * 4 + 2 ;
491
+ indices[i * 4 + 3 ] = i * 4 + 3 ;
492
+ v3f r = m_stars[i];
493
+ core::CMatrix4<f32> a;
494
+ a.buildRotateFromTo (v3f (0 , 1 , 0 ), r);
495
+ v3f p = v3f (-d, 1 , -d);
496
+ v3f p1 = v3f ( d, 1 , -d);
497
+ v3f p2 = v3f ( d, 1 , d);
498
+ v3f p3 = v3f (-d, 1 , d);
499
+ a.rotateVect (p);
500
+ a.rotateVect (p1);
501
+ a.rotateVect (p2);
502
+ a.rotateVect (p3);
503
+ p.rotateXYBy (wicked_time_of_day * 360 - 90 );
504
+ p1.rotateXYBy (wicked_time_of_day * 360 - 90 );
505
+ p2.rotateXYBy (wicked_time_of_day * 360 - 90 );
506
+ p3.rotateXYBy (wicked_time_of_day * 360 - 90 );
507
+ vertices[i * 4 + 0 ].Pos = p;
508
+ vertices[i * 4 + 0 ].Color = starcolor;
509
+ vertices[i * 4 + 1 ].Pos = p1;
510
+ vertices[i * 4 + 1 ].Color = starcolor;
511
+ vertices[i * 4 + 2 ].Pos = p2;
512
+ vertices[i * 4 + 2 ].Color = starcolor;
513
+ vertices[i * 4 + 3 ].Pos = p3;
514
+ vertices[i * 4 + 3 ].Color = starcolor;
515
+ }
516
+ driver->drawVertexPrimitiveList (vertices, SKY_STAR_COUNT * 4 ,
517
+ indices, SKY_STAR_COUNT, video::EVT_STANDARD,
518
+ scene::EPT_QUADS, video::EIT_16BIT);
519
+ #endif
520
+ } while (false );
521
+
522
522
// Draw far cloudy fog thing below east and west horizons
523
523
for (u32 j = 0 ; j < 2 ; j++) {
524
524
video::SColor c = cloudyfogcolor;
0 commit comments