Polished up daylight cycles
by Chris \"Hobbiticus\" Weiland · 03/31/2003 (11:10 am) · 71 comments
Download Code File
Basically, I've rewritten and torque-ized Josh Ritter's day/night cycles to be a lot more robust. Instead of keeping everything in ugly and "unstable" externs, I've put everything into it's own class with good stuff like information hiding. It's still a little ugly because of all of the statics, however.
All you should have to do is apply the patch to a head version of torque, add the game/fx/daylightCycle.h/cc to your project file, compile and run.
Also, IF YOU GET MY TERRAIN BUMP MAPPING CODE (now available), you can go change this:
Then you will get dynamically generated bumps that change with the sun vector!
Added benefits:
Ability to get sunlight vector/color easily, only runs when sky is being rendered, modular, scalable, toggleable.
Have fun!
Basically, I've rewritten and torque-ized Josh Ritter's day/night cycles to be a lot more robust. Instead of keeping everything in ugly and "unstable" externs, I've put everything into it's own class with good stuff like information hiding. It's still a little ugly because of all of the statics, however.
All you should have to do is apply the patch to a head version of torque, add the game/fx/daylightCycle.h/cc to your project file, compile and run.
Also, IF YOU GET MY TERRAIN BUMP MAPPING CODE (now available), you can go change this:
VectorF sunVector; //if you use my updated day/night cycles you can use this for dynamic bumps //sunVector = DaylightCycle::getTrueSunVector(); static Vector<LightInfo*> lights; lights.clear(); gClientSceneGraph->getLightManager()->getLights(lights); sunVector = -lights[0]->mDirection; //first light is always sun //find s and t tangentsto this:
VectorF sunVector = DaylightCycle::getTrueSunVector(); //find s and t tangentsin terrRender.cc
Then you will get dynamically generated bumps that change with the sun vector!
Added benefits:
Ability to get sunlight vector/color easily, only runs when sky is being rendered, modular, scalable, toggleable.
Have fun!
#62
Now I just have to integrate it with the time/weather manager.
Cheers.
12/05/2004 (9:04 am)
I have a patch file against the current head if anyone needs it, since I just found how easy it is to make a patch with TortoiseCVS. Just mail me.Now I just have to integrate it with the time/weather manager.
Cheers.
#63
12/26/2004 (1:02 pm)
#64
12/26/2004 (1:05 pm)
#65
xFoliageReplicator.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
interiorRender.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
fluidRender.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
fxSunLight.obj : error LNK2001: unresolved external symbol "public: static class fxSunLight * DaylightCycle::mSunFlare" (?mSunFlare@DaylightCycle@@2PAVfxSunLight@@A)
fxSunLight.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentBandColor" (?mCurrentBandColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentBandColor" (?mCurrentBandColor@DaylightCycle@@0VColorF@@A)
shapeBase.obj : error LNK2001: unresolved external symbol "private: static class Point3F DaylightCycle::mSunVector" (?mSunVector@DaylightCycle@@0VPoint3F@@A)
sceneLighting.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mSun" (?mSun@DaylightCycle@@2PAVSun@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mSun" (?mSun@DaylightCycle@@2PAVSun@@A)
sceneLighting.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mServerSun" (?mServerSun@DaylightCycle@@2PAVSun@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mServerSun" (?mServerSun@DaylightCycle@@2PAVSun@@A)
fluidRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::disableGLLighting(void)" (?disableGLLighting@DaylightCycle@@SAXXZ)
terrRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::disableGLLighting(void)" (?disableGLLighting@DaylightCycle@@SAXXZ)
fluidRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::enableGLLighting(float)" (?enableGLLighting@DaylightCycle@@SAXM@Z)
terrRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::enableGLLighting(float)" (?enableGLLighting@DaylightCycle@@SAXM@Z)
sky.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::calcColors(void)" (?calcColors@DaylightCycle@@SAXXZ)
sky.obj : error LNK2001: unresolved external symbol "private: static float DaylightCycle::mBandMod" (?mBandMod@DaylightCycle@@0MA)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mFogColor" (?mFogColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mOrigionalFogColor" (?mOrigionalFogColor@DaylightCycle@@0VColorF@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::setOrigionalLight(void)" (?setOrigionalLight@DaylightCycle@@SAXXZ)
sun.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::init(void)" (?init@DaylightCycle@@SAXXZ)
now im familiar with c++. not a pro but decent. although ive always had problems with large programs and unresolved externals. not exactly sure what causes that type of error. any help would be aprreciated. thanks
03/07/2005 (12:18 am)
i manually made the patch and added the c and h files to the project tree, saved all, etc, but when i compiled i got 23 external errors. xFoliageReplicator.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
interiorRender.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
fluidRender.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentColor" (?mCurrentColor@DaylightCycle@@0VColorF@@A)
fxSunLight.obj : error LNK2001: unresolved external symbol "public: static class fxSunLight * DaylightCycle::mSunFlare" (?mSunFlare@DaylightCycle@@2PAVfxSunLight@@A)
fxSunLight.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentBandColor" (?mCurrentBandColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mCurrentBandColor" (?mCurrentBandColor@DaylightCycle@@0VColorF@@A)
shapeBase.obj : error LNK2001: unresolved external symbol "private: static class Point3F DaylightCycle::mSunVector" (?mSunVector@DaylightCycle@@0VPoint3F@@A)
sceneLighting.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mSun" (?mSun@DaylightCycle@@2PAVSun@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mSun" (?mSun@DaylightCycle@@2PAVSun@@A)
sceneLighting.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mServerSun" (?mServerSun@DaylightCycle@@2PAVSun@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static class Sun * DaylightCycle::mServerSun" (?mServerSun@DaylightCycle@@2PAVSun@@A)
fluidRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::disableGLLighting(void)" (?disableGLLighting@DaylightCycle@@SAXXZ)
terrRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::disableGLLighting(void)" (?disableGLLighting@DaylightCycle@@SAXXZ)
fluidRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::enableGLLighting(float)" (?enableGLLighting@DaylightCycle@@SAXM@Z)
terrRender.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::enableGLLighting(float)" (?enableGLLighting@DaylightCycle@@SAXM@Z)
sky.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::calcColors(void)" (?calcColors@DaylightCycle@@SAXXZ)
sky.obj : error LNK2001: unresolved external symbol "private: static float DaylightCycle::mBandMod" (?mBandMod@DaylightCycle@@0MA)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mFogColor" (?mFogColor@DaylightCycle@@0VColorF@@A)
sky.obj : error LNK2001: unresolved external symbol "private: static class ColorF DaylightCycle::mOrigionalFogColor" (?mOrigionalFogColor@DaylightCycle@@0VColorF@@A)
sun.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::setOrigionalLight(void)" (?setOrigionalLight@DaylightCycle@@SAXXZ)
sun.obj : error LNK2001: unresolved external symbol "public: static void __cdecl DaylightCycle::init(void)" (?init@DaylightCycle@@SAXXZ)
now im familiar with c++. not a pro but decent. although ive always had problems with large programs and unresolved externals. not exactly sure what causes that type of error. any help would be aprreciated. thanks
#66
great system. now i just need a console/script command to return/set the current game hour that the sun uses ;)
03/07/2005 (1:51 pm)
never mind i got it, i was using the wrong project file for my compile....doh!great system. now i just need a console/script command to return/set the current game hour that the sun uses ;)
#67
I've applied the patch and the sun is moving nicely across the sky. However, the render band nearest the horizon sticks out. Its a solid color (the fog color I believe) and it does not blend to the next render band. Any ideas how I can fix this?
06/29/2005 (4:51 am)
Hello,I've applied the patch and the sun is moving nicely across the sky. However, the render band nearest the horizon sticks out. Its a solid color (the fog color I believe) and it does not blend to the next render band. Any ideas how I can fix this?
#68
02/25/2006 (11:14 am)
Hm, will this patch overwrite any of my stuff? What kind of stuff does this patch over-write?
#69
03/16/2006 (12:13 am)
#70
03/16/2006 (1:29 pm)
It would be much easier if we didnt have to patch it, in my opinion.
#71
06/27/2007 (7:55 pm)
does anyone here knows how to install the patch..? i have been finding the program for installing the patch for the past few day and yet to know how to install it.. does WinCVS able to install the patch..? if yes can u teach me steps by steps..? or is there any tutorial on the internet that teaches that.. i found a lot of site in the garagegames.com but then none of them teach me how to do it.. pls.. help..!!! 
Torque Owner Josh Moore