mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-10 14:51:40 +00:00
Use ZDRayInfo's angle and pitch to determine the sun direction
This commit is contained in:
parent
b42d771e17
commit
7f822dd250
1 changed files with 9 additions and 12 deletions
|
@ -104,6 +104,15 @@ void FLevel::SetupLights()
|
|||
vec3 sundir(0.0f, 0.0f, 0.0f);
|
||||
vec3 suncolor(1.0f, 1.0f, 1.0f);
|
||||
|
||||
// to do: is the math here correct?
|
||||
float sdx = (float)std::cos(radians(thing->angle)) * (float)std::cos(radians(thing->pitch));
|
||||
float sdy = (float)std::sin(radians(thing->angle)) * (float)std::cos(radians(thing->pitch));
|
||||
float sdz = (float)-std::sin(radians(thing->pitch));
|
||||
sundir.x = -sdx;
|
||||
sundir.y = -sdy;
|
||||
sundir.z = -sdz;
|
||||
//printf("sun vector: %f, %f, %f\n", sundir.x, sundir.y, sundir.z);
|
||||
|
||||
for (unsigned int propIndex = 0; propIndex < thing->props.Size(); propIndex++)
|
||||
{
|
||||
const UDMFKey& key = thing->props[propIndex];
|
||||
|
@ -111,18 +120,6 @@ void FLevel::SetupLights()
|
|||
{
|
||||
lightcolor = atoi(key.value);
|
||||
}
|
||||
else if (!stricmp(key.key, "sundirx"))
|
||||
{
|
||||
sundir.x = atof(key.value);
|
||||
}
|
||||
else if (!stricmp(key.key, "sundiry"))
|
||||
{
|
||||
sundir.y = atof(key.value);
|
||||
}
|
||||
else if (!stricmp(key.key, "sundirz"))
|
||||
{
|
||||
sundir.z = atof(key.value);
|
||||
}
|
||||
else if (!stricmp(key.key, "sampledistance"))
|
||||
{
|
||||
Samples = atoi(key.value);
|
||||
|
|
Loading…
Reference in a new issue