So I'll stick with checks like this:
Code: Select all
mNode->setScale(Ogre::Vector3::UNIT_SCALE * ((cam->getFarClipDistance () == 0 ) ? 100000 : (cam->getFarClipDistance ()-0.2)));
Azatoth have you tested Caelum with your client, any screenshots ?
Code: Select all
mNode->setScale(Ogre::Vector3::UNIT_SCALE * ((cam->getFarClipDistance () == 0 ) ? 100000 : (cam->getFarClipDistance ()-0.2)));
Code: Select all
An exception has been thrown!
-----------------------------------
Details:
-----------------------------------
Error #: -2005529767
Function: D3D9GpuProgram::loadFromSource
Description: Cannot assemble D3D9 shader LayeredCloudFP Errors:
(57): error X2005: invalid register 'r12'
(58): error X2005: invalid register 'r12'
(59): error X2005: invalid register 'r12'
(60): error X2005: invalid register 'r12'
(61): error X2005: invalid register 'r12'
(62): error X2005: invalid register 'r12'
(63): error X2005: invalid register 'r12'
(64): error X2005: invalid register 'r12'
(65): error X2005: invalid register 'r12'
(66): error X2005: invalid register 'r12'
(67): error X2005: invalid register 'r12'
(68): error X2005: invalid register 'r12'
(69): error X2005: invalid register 'r12'
(70): error X2005: invalid register 'r12'
(71): error X2005: invalid register 'r12'
(72): error X2005: invalid register 'r12'
(73): error X2005: invalid register 'r12'
(74): error X2005: invalid register 'r12'
(75): error X2005: invalid register 'r12'
(76): error X2005: invalid register 'r12'
(77): error X2005: invalid register 'r12'
(78): error X2005: invalid register 'r12'
(79): error X2005: invalid register 'r12'
(80): error X2005: invalid register 'r12'
.
File: e:\projects\ogrecvs\branches\dagon_vc8_clean\ogrenew\rendersystems\direct3d9\src\ogred3d9gpuprogram.cpp
Line: 91
Stack unwinding: <<beginning of stack>>
Code: Select all
Function: D3D9GpuProgram::loadFromSource
Description: Cannot assemble D3D9 shader LayeredCloudFP Errors:
(48): error X5775: Dependent tex-op sequence too long (4th order). A 1st order dependent tex-op is a tex[ld*|kill] instruction in which either: (1) an r# reg is input (NOT t# reg), or (2) output r# reg was previously written, now being written AGAIN. A 2nd order dependent tex-op occurs if: a tex-op reads OR WRITES to an r# reg whose contents, BEFORE executing the tex-op, depend (perhaps indirectly) on the outcome of a 1st order dependent tex-op. An (n)th order dependent tex-op derives from an (n-1)th order tex-op. A given tex-op may be dependent to at most 3rd order (ps_2_0/x only).
.
Code: Select all
absorption += clamp (tex2D (cloud, (uv + sunDirection * 0.2 + cloudOffset) * cloudInvScale) + tex2D (detail, (uv + sunDirection * 0.2 + detailOffset) * detailInvScale) - 1, 0, 1);
I've integrated the caelum code into Ember. Some screenshots:er wrote:Azatoth have you tested Caelum with your client, any screenshots ?
Code: Select all
diff -U 3 -dHbrN -- /home/erik/ember/var/Caelum/include/CaelumPrerequisites.h ./include/CaelumPrerequisites.h
--- /home/erik/ember/var/Caelum/include/CaelumPrerequisites.h 2006-10-22 15:57:32.000000000 +0200
+++ ./include/CaelumPrerequisites.h 2006-11-06 23:47:49.000000000 +0100
@@ -2,18 +2,18 @@
#define CAELUMPREREQUISITES_H
// Include external headers
-#include "Ogre.h"
+#include <Ogre.h>
// Define the dll export qualifier if compiling for Windows
-#ifdef OGRE_PLATFORM_WIN32
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define DllExport __declspec (dllexport)
#else
#define DllExport
#endif
// Define the version code
-#define VERSION 0
-#define SUBVERSION 2
+#define CAELUM_VERSION 0
+#define CAELUM_SUBVERSION 2
/* Set a global camera distances modifier for the clipping distance.
This threshold will be substracted from the far clipping distance if applicable, else it will be
diff -U 3 -dHbrN -- /home/erik/ember/var/Caelum/include/Sun.h ./include/Sun.h
--- /home/erik/ember/var/Caelum/include/Sun.h 2006-10-10 21:50:12.000000000 +0200
+++ ./include/Sun.h 2006-11-05 23:10:31.000000000 +0100
@@ -93,12 +93,22 @@
*/
Ogre::ColourValue getSunColour ();
+ /** Gets the sun node.
+ @return The sun node.
+ */
+ inline Ogre::SceneNode* getNode() const;
+
private:
/** Creates the sun material.
*/
void createSunMaterial ();
};
+Ogre::SceneNode* Sun::getNode() const
+{
+ return mSunNode;
+}
+
} // namespace caelum
#endif //SUN_H
diff -U 3 -dHbrN -- /home/erik/ember/var/Caelum/src/CaelumSystem.cpp ./src/CaelumSystem.cpp
--- /home/erik/ember/var/Caelum/src/CaelumSystem.cpp 2006-10-22 15:45:20.000000000 +0200
+++ ./src/CaelumSystem.cpp 2006-11-03 00:17:03.000000000 +0100
@@ -10,7 +10,6 @@
mOgreRoot = root;
mSceneMgr = sceneMgr;
- mOgreRoot->addFrameListener (this);
createSkyDomeMaterial ();
createStarfieldMaterial ();
@@ -28,6 +27,8 @@
mStarfield = 0;
+ ///add ourselves as frame listener last, since if there's a problem here. there will be no valid object
+ mOgreRoot->addFrameListener (this);
LOG ("DONE");
}
diff -U 3 -dHbrN -- /home/erik/ember/var/Caelum/src/StoredImageSkyColourModel.cpp ./src/StoredImageSkyColourModel.cpp
--- /home/erik/ember/var/Caelum/src/StoredImageSkyColourModel.cpp 2006-10-22 16:17:45.000000000 +0200
+++ ./src/StoredImageSkyColourModel.cpp 2006-10-25 23:15:15.000000000 +0200
@@ -10,7 +10,7 @@
void StoredImageSkyColourModel::setSkyGradientsImage (const Ogre::String &gradients) {
if (mSkyGradientsTextureUnitState) {
// Dagon and Eihort compatibility
- #if OGRE_VERSION < 0x130
+ #if OGRE_VERSION < ((1 << 16) | (3 << 8) | 0)
mSkyGradientsTextureUnitState->setTextureName (gradients, Ogre::TEX_TYPE_2D, -1, true);
#else
mSkyGradientsTextureUnitState->setTextureName (gradients, Ogre::TEX_TYPE_2D);
Code: Select all
class CloudsUpdater : public caelum::CaelumListener {
public:
bool caelumStarted (const Ogre::FrameEvent &e, caelum::CaelumSystem *sys) {
Ogre::MaterialPtr mat = static_cast<Ogre::MaterialPtr >(Ogre::MaterialManager::getSingleton ().getByName ("Altocumulus"));
if (!mat.isNull()) {
Ogre::Technique* tech = mat->getBestTechnique ();
if (tech) {
Ogre::Pass* pass = tech->getPass(0);
if (pass) {
pass->getVertexProgramParameters ()->setNamedConstant ("sunDirection", sys->getSun ()->getSunDirection ());
pass->getFragmentProgramParameters ()->setNamedConstant ("sunDirection", sys->getSun ()->getSunDirection ());
}
}
}
return true;
}
};
Code: Select all
svn checkout https://svn.sourceforge.net/svnroot/caelum caelum
Code: Select all
svn update
Here we go: this patch allows to set the size of the skydome and starfield to a manual size.Praetor wrote: Maybe a patch might be useful pricorde that makes the sky dome size an easy-to-set parameter so people with different size environments can use it easily.
Code: Select all
Index: include/SkyDome.h
===================================================================
--- include/SkyDome.h (revision 1)
+++ include/SkyDome.h (working copy)
@@ -20,6 +20,10 @@
*/
static const Ogre::String mSphericDomeResourceName;
+ /** Definces if the dome radius is automatically set or not.
+ */
+ bool autoRadius;
+
// Methods --------------------------------------------------------------------
public:
/** Constructor (DO NOT USE! Use CaelumSystem::createSkyDome instead).
@@ -31,6 +35,12 @@
*/
~SkyDome ();
+ /** Forces the size of the skydome to a specific radius.
+ If the parameter is negative, the radius is set automatically.
+ @param size The size of the skydome, or a negative value.
+ */
+ void setSize (float size);
+
/** Event trigger called just before rendering a viewport in a render target this dome is attached to.
Useful to make the dome follow every camera that renders a viewport in a certain render target.
@param e The viewport event, containing the viewport (and camera) to be rendered right now.
Index: include/Starfield.h
===================================================================
--- include/Starfield.h (revision 1)
+++ include/Starfield.h (working copy)
@@ -24,6 +24,10 @@
*/
Ogre::Degree mInclination;
+ /** Defines if the dome radius is automatically set or not.
+ */
+ bool autoRadius;
+
// Methods --------------------------------------------------------------------
public:
/** Constructor.
@@ -41,6 +45,12 @@
*/
void preViewportUpdate (const Ogre::RenderTargetViewportEvent &e);
+ /** Forces the size of the starfield to a specific radius.
+ If the parameter is negative, the radius is set automatically.
+ @param size The size of the starfiels, or a negative value.
+ */
+ void setSize (float size);
+
/** Sets the starfield inclination.
@param inc The starfield inclination in degrees.
*/
Index: src/SkyDome.cpp
===================================================================
--- src/SkyDome.cpp (revision 1)
+++ src/SkyDome.cpp (working copy)
@@ -14,6 +14,7 @@
ent->setRenderQueueGroup (Ogre::RENDER_QUEUE_SKIES_EARLY + 2);
ent->setCastShadows (false);
mNode->attachObject (ent);
+ autoRadius=true;
}
SkyDome::~SkyDome () {
@@ -21,13 +22,25 @@
static_cast<Ogre::SceneNode *>(mNode->getParent ())->removeAndDestroyChild (mNode->getName ());
}
+void SkyDome::setSize(float size) {
+ if (size>0)
+ {
+ mNode->setScale(Ogre::Vector3::UNIT_SCALE*size);
+ autoRadius=false;
+ }
+ else autoRadius=true; //size will be updated at the next viewport update
+}
+
void SkyDome::preViewportUpdate (const Ogre::RenderTargetViewportEvent &e) {
Ogre::Camera *cam = e.source->getCamera ();
mNode->setPosition (cam->getRealPosition ());
- if (cam->getFarClipDistance () > 0)
- mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getFarClipDistance () - CAMERA_DISTANCE_MODIFIER));
- else
- mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getNearClipDistance () + CAMERA_DISTANCE_MODIFIER));
+ if (autoRadius)
+ {
+ if (cam->getFarClipDistance () > 0)
+ mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getFarClipDistance () - CAMERA_DISTANCE_MODIFIER));
+ else
+ mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getNearClipDistance () + CAMERA_DISTANCE_MODIFIER));
+ }
}
} // namespace caelum
Index: src/Starfield.cpp
===================================================================
--- src/Starfield.cpp (revision 1)
+++ src/Starfield.cpp (working copy)
@@ -14,6 +14,7 @@
ent->setRenderQueueGroup (Ogre::RENDER_QUEUE_SKIES_EARLY + 1);
ent->setCastShadows (false);
mNode->attachObject (ent);
+ autoRadius=true;
mInclination = Ogre::Degree (0);
}
@@ -23,13 +24,26 @@
static_cast<Ogre::SceneNode *>(mNode->getParent ())->removeAndDestroyChild (mNode->getName ());
}
+void Starfield::setSize(float size) {
+ if (size>0)
+ {
+ mNode->setScale(Ogre::Vector3::UNIT_SCALE*size);
+ autoRadius=false;
+ }
+ else autoRadius=true; //size will be updated at the next viewport update
+}
+
+
void Starfield::preViewportUpdate (const Ogre::RenderTargetViewportEvent &e) {
Ogre::Camera *cam = e.source->getCamera ();
mNode->setPosition (cam->getRealPosition ());
- if (cam->getFarClipDistance () > 0)
- mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getFarClipDistance () - CAMERA_DISTANCE_MODIFIER));
- else
- mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getNearClipDistance () + CAMERA_DISTANCE_MODIFIER));
+ if (autoRadius)
+ {
+ if (cam->getFarClipDistance () > 0)
+ mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getFarClipDistance () - CAMERA_DISTANCE_MODIFIER));
+ else
+ mNode->setScale (Ogre::Vector3::UNIT_SCALE * (cam->getNearClipDistance () + CAMERA_DISTANCE_MODIFIER));
+ }
}
void Starfield::setInclination (Ogre::Degree inc) {
Yes, thought about that too. It is also a good opportunity to look how I can light the terrain with vehicles lights and make a nice night modePraetor wrote: As for your terrain shadows, you could think about baking out a dozen or so terrain shadow maps for different times of the day and interpolating between them in a shader.
Of course not! I've seen you have also a nice caelum logo - another good one for my credits screenKencho wrote:PS: I've uploaded your screenshots to my blog. Hope you don't mind