- if(wicked_time_of_day > 0.15 && wicked_time_of_day < 0.85)
- {
- float d = sunsize * 1.7;
- video::SColor c = suncolor;
- c.setAlpha(0.05*255);
- vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, c, t, t);
- vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, c, o, t);
- vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, c, o, o);
- vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, c, t, o);
- for(u32 i=0; i<4; i++){
- // Switch from -Z (south) to +X (east)
- vertices[i].Pos.rotateXZBy(90);
- vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
- }
- driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
-
- d = sunsize * 1.2;
- c = suncolor;
- c.setAlpha(0.15*255);
- vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, c, t, t);
- vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, c, o, t);
- vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, c, o, o);
- vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, c, t, o);
- for(u32 i=0; i<4; i++){
- // Switch from -Z (south) to +X (east)
- vertices[i].Pos.rotateXZBy(90);
- vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
- }
- driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
-
- d = sunsize;
- vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, suncolor, t, t);
- vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, suncolor, o, t);
- vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, suncolor, o, o);
- vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, suncolor, t, o);
- for(u32 i=0; i<4; i++){
- // Switch from -Z (south) to +X (east)
- vertices[i].Pos.rotateXZBy(90);
- vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
- }
- driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
-
- d = sunsize * 0.7;
- vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, suncolor2, t, t);
- vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, suncolor2, o, t);
- vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, suncolor2, o, o);
- vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, suncolor2, t, o);
- for(u32 i=0; i<4; i++){
- // Switch from -Z (south) to +X (east)
- vertices[i].Pos.rotateXZBy(90);
- vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ if(wicked_time_of_day > 0.15 && wicked_time_of_day < 0.85){
+ if (!m_sun_texture){
+ driver->setMaterial(m_materials[1]);
+ float d = sunsize * 1.7;
+ video::SColor c = suncolor;
+ c.setAlpha(0.05*255);
+ vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, c, t, t);
+ vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, c, o, t);
+ vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, c, o, o);
+ vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, c, t, o);
+ for(u32 i=0; i<4; i++){
+ // Switch from -Z (south) to +X (east)
+ vertices[i].Pos.rotateXZBy(90);
+ vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ }
+ driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
+
+ d = sunsize * 1.2;
+ c = suncolor;
+ c.setAlpha(0.15*255);
+ vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, c, t, t);
+ vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, c, o, t);
+ vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, c, o, o);
+ vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, c, t, o);
+ for(u32 i=0; i<4; i++){
+ // Switch from -Z (south) to +X (east)
+ vertices[i].Pos.rotateXZBy(90);
+ vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ }
+ driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
+
+ d = sunsize;
+ vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, suncolor, t, t);
+ vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, suncolor, o, t);
+ vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, suncolor, o, o);
+ vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, suncolor, t, o);
+ for(u32 i=0; i<4; i++){
+ // Switch from -Z (south) to +X (east)
+ vertices[i].Pos.rotateXZBy(90);
+ vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ }
+ driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
+
+ d = sunsize * 0.7;
+ vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, suncolor2, t, t);
+ vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, suncolor2, o, t);
+ vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, suncolor2, o, o);
+ vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, suncolor2, t, o);
+ for(u32 i=0; i<4; i++){
+ // Switch from -Z (south) to +X (east)
+ vertices[i].Pos.rotateXZBy(90);
+ vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ }
+ driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);
+ } else {
+ driver->setMaterial(m_materials[3]);
+ float d = sunsize * 1.7;
+ video::SColor c;
+ if (m_sun_tonemap)
+ c = video::SColor (0,0,0,0);
+ else
+ c = video::SColor (255,255,255,255);
+ vertices[0] = video::S3DVertex(-d,-d,-1, 0,0,1, c, t, t);
+ vertices[1] = video::S3DVertex( d,-d,-1, 0,0,1, c, o, t);
+ vertices[2] = video::S3DVertex( d, d,-1, 0,0,1, c, o, o);
+ vertices[3] = video::S3DVertex(-d, d,-1, 0,0,1, c, t, o);
+ for(u32 i=0; i<4; i++){
+ // Switch from -Z (south) to +X (east)
+ vertices[i].Pos.rotateXZBy(90);
+ vertices[i].Pos.rotateXYBy(wicked_time_of_day * 360 - 90);
+ }
+ driver->drawIndexedTriangleFan(&vertices[0], 4, indices, 2);