From: curt Date: Tue, 17 Sep 2002 16:08:00 +0000 (+0000) Subject: Latest changes from John. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fcf1d34e556de7b10a047d01caf961ad220591d3;p=simgear.git Latest changes from John. --- diff --git a/simgear/scene/sky/clouds3d/SkyArchive.cpp b/simgear/scene/sky/clouds3d/SkyArchive.cpp index 3ca8e5ef..30344f37 100644 --- a/simgear/scene/sky/clouds3d/SkyArchive.cpp +++ b/simgear/scene/sky/clouds3d/SkyArchive.cpp @@ -957,7 +957,7 @@ bool SkyArchive::IsEmpty() const * @fn SkyArchive::Load(const char* pFileName) * @brief Load the contents of a SkyArchive from file storage. */ -bool SkyArchive::Load(const char* pFileName) +SKYRESULT SkyArchive::Load(const char* pFileName) { if (!pFileName) { FAIL_RETURN_MSG(SKYRESULT_FAIL, "Error: SkyArchive::Load(): file name is NULL."); @@ -966,14 +966,14 @@ bool SkyArchive::Load(const char* pFileName) if (NULL == (pSrcFile = fopen(pFileName, "rb"))) // file opened successfully { SkyTrace("Error: SkyArchive::Load(): failed to open file for reading."); - return false; + return SKYRESULT_FAIL; } SKYRESULT retVal = _Load(pSrcFile); fclose(pSrcFile); FAIL_RETURN(retVal); - return true; + return SKYRESULT_OK; } //------------------------------------------------------------------------------ diff --git a/simgear/scene/sky/clouds3d/SkyArchive.hpp b/simgear/scene/sky/clouds3d/SkyArchive.hpp index 55990c87..a93dfbf2 100644 --- a/simgear/scene/sky/clouds3d/SkyArchive.hpp +++ b/simgear/scene/sky/clouds3d/SkyArchive.hpp @@ -208,7 +208,7 @@ public: SKYRESULT MakeEmpty(); // Loads the contents from a file. - bool Load(const char* pFileName); + SKYRESULT Load(const char* pFileName); // Commits the contents of a SkyArchive to file storage. SKYRESULT Save(const char* pFileName) const; diff --git a/simgear/scene/sky/clouds3d/SkyBoundingVolume.hpp b/simgear/scene/sky/clouds3d/SkyBoundingVolume.hpp index 1e5ee026..4a9e32cb 100644 --- a/simgear/scene/sky/clouds3d/SkyBoundingVolume.hpp +++ b/simgear/scene/sky/clouds3d/SkyBoundingVolume.hpp @@ -23,8 +23,8 @@ #ifndef __SKYBOUNDINGVOLUME_HPP__ #define __SKYBOUNDINGVOLUME_HPP__ -#include -#include +#include "vec3f.hpp" +#include "mat44.hpp" // forward to reduce unnecessary dependencies class Camera; diff --git a/simgear/scene/sky/clouds3d/SkyCloud.cpp b/simgear/scene/sky/clouds3d/SkyCloud.cpp index c3cbbd77..cf3574f8 100644 --- a/simgear/scene/sky/clouds3d/SkyCloud.cpp +++ b/simgear/scene/sky/clouds3d/SkyCloud.cpp @@ -666,7 +666,8 @@ SKYRESULT SkyCloud::Load(const SkyArchive &archive, _particles.push_back(pParticle); } // this is just a bad hack to align cloud field from skyworks with local horizon at KSFO - // we need to develop out own scheme for loading and positioning clouds + // this "almost" works not quite the right solution okay to get some up and running + // we need to develop our own scheme for loading and positioning clouds Mat33f rot_mat; Vec3f moveit; @@ -676,9 +677,9 @@ SKYRESULT SkyCloud::Load(const SkyArchive &archive, // flip the y and z axis, clouds now sit in the x-y plane Rotate( rot_mat ); - // adjust for lon af KSFO -122.357 - rot_mat.Set( -0.76604f, 0.64277f, 0.0f, - -0.64277f, -0.76604f, 0.0f, + // adjust for lon af KSFO plus -122.357 + rot_mat.Set( -0.84473f, 0.53519f, 0.0f, + -0.53519f, -0.84473f, 0.0f, 0.0f, 0.0f, 1.0f); //Rotate( rot_mat ); @@ -690,7 +691,7 @@ SKYRESULT SkyCloud::Load(const SkyArchive &archive, Rotate( rot_mat ); - moveit.Set( 0.0, 0.0, 4050.0 ); + moveit.Set( 1000.0, 0.0, 4050.0 ); Translate( moveit ); diff --git a/simgear/scene/sky/clouds3d/SkyRenderableInstance.hpp b/simgear/scene/sky/clouds3d/SkyRenderableInstance.hpp index 9c09a509..513dddba 100644 --- a/simgear/scene/sky/clouds3d/SkyRenderableInstance.hpp +++ b/simgear/scene/sky/clouds3d/SkyRenderableInstance.hpp @@ -24,8 +24,8 @@ #define __SKYRENDERABLEINSTANCE_HPP__ #include -#include -#include +#include "mat33.hpp" +#include "mat44.hpp" #include "SkyUtil.hpp" // forward to reduce unnecessary dependencies diff --git a/simgear/scene/sky/clouds3d/SkySceneLoader.cpp b/simgear/scene/sky/clouds3d/SkySceneLoader.cpp index 4ceac499..ad9af546 100644 --- a/simgear/scene/sky/clouds3d/SkySceneLoader.cpp +++ b/simgear/scene/sky/clouds3d/SkySceneLoader.cpp @@ -121,7 +121,7 @@ bool SkySceneLoader::Load(std::string filename) FAIL_RETURN(archive.FindString("CloudFile", &pFilename, i)); float rScale = 1.0; FAIL_RETURN(archive.FindFloat32("CloudScale", &rScale, i)); - rScale = 20.0; + rScale = 30.0; SkyArchive cloudArchive; FAIL_RETURN(cloudArchive.Load(pFilename)); FAIL_RETURN(SceneManager::InstancePtr()->LoadClouds(cloudArchive, rScale)); @@ -129,7 +129,7 @@ bool SkySceneLoader::Load(std::string filename) } Vec3f dir(0, 0, 1); - pLight->SetPosition(Vec3f(3000, 0, 7000)); + pLight->SetPosition(Vec3f(0, 0, 7000)); pLight->SetDirection(dir); pLight->SetAmbient(Vec4f( 0.0f, 0.0f, 0.0f, 0.0f)); pLight->SetDiffuse(Vec4f(1.0f, 1.0f, 1.0f, 0.0f)); @@ -146,8 +146,7 @@ bool SkySceneLoader::Load(std::string filename) } void SkySceneLoader::Set_Cloud_Orig( Point3D *posit ) -{ // use this to adjust camera position for a new tile center - +{ // set origin for cloud coordinates to initial tile center origin = *posit; sgdSetVec3( delta, origin[0], origin[1], origin[2]); @@ -157,6 +156,12 @@ void SkySceneLoader::Set_Cloud_Orig( Point3D *posit ) void SkySceneLoader::Update( double *view_pos ) { + + double wind_x, wind_y, wind_z; + wind_x = -0.05; wind_z = 0.05; + // just a dumb test to see if we can move the clouds en masse via the camera + delta[0] += wind_x; delta[2] += wind_z; + sgdSubVec3( cam_pos, view_pos, delta ); //cout << "ORIGIN: " << delta[0] << " " << delta[1] << " " << delta[2] << endl; //cout << "CAM : " << cam_pos[0] << " " << cam_pos[1] << " " << cam_pos[2] << endl; diff --git a/simgear/scene/sky/clouds3d/SkySceneManager.cpp b/simgear/scene/sky/clouds3d/SkySceneManager.cpp index a316f19d..26af872b 100644 --- a/simgear/scene/sky/clouds3d/SkySceneManager.cpp +++ b/simgear/scene/sky/clouds3d/SkySceneManager.cpp @@ -33,8 +33,6 @@ #include "SkyRenderable.hpp" #include "SkyRenderableInstance.hpp" #include "SkyRenderableInstanceCloud.hpp" -//#include "SkyHeavens.hpp" -//#include "SkyHeightField.hpp" #include "camutils.hpp" #include @@ -518,7 +516,7 @@ SKYRESULT SkySceneManager::LoadClouds(SkyArchive& cloudArchive, float rScale /* SkyArchive subArchive; //iNumClouds = 5; //set this value to reduce cloud field for debugging for (int i = 0; i < iNumClouds; ++i) - { printf("Loading # %d of %d clouds\n", i, iNumClouds); + { printf("Loading # %d of %d clouds\n", i+1, iNumClouds); cloudArchive.FindArchive("Cloud", &subArchive, i); SkyCloud *pCloud = new SkyCloud(); pCloud->Load(subArchive, rScale); diff --git a/simgear/scene/sky/clouds3d/SkyTextureManager.cpp b/simgear/scene/sky/clouds3d/SkyTextureManager.cpp index 346d7e78..92f01797 100644 --- a/simgear/scene/sky/clouds3d/SkyTextureManager.cpp +++ b/simgear/scene/sky/clouds3d/SkyTextureManager.cpp @@ -872,12 +872,12 @@ SKYRESULT SkyTextureManager::_Create3DTextureObject(SkyTexture &texture, * Deletes the data as well as the OpenGL texture ID(s). */ void SkyTextureManager::DestroyTextureObject(SkyTexture &texture) -{ - /*if (texture.GetID) +{ /* + if (texture.GetID) glDeleteTextures(1, &(texture.iTextureID)); if (texture.bSliced3D && texture.pSliceIDs) { glDeleteTextures(texture.iDepth, texture.pSliceIDs); delete [] texture.pSliceIDs; - }*/ + } */ } diff --git a/simgear/scene/sky/clouds3d/SkyTextureState.cpp b/simgear/scene/sky/clouds3d/SkyTextureState.cpp index e8ee29b2..f8a0d1ed 100644 --- a/simgear/scene/sky/clouds3d/SkyTextureState.cpp +++ b/simgear/scene/sky/clouds3d/SkyTextureState.cpp @@ -126,7 +126,7 @@ SKYRESULT SkyTextureState::Activate() if (pCurrent->GetTextureParameter(i, GL_TEXTURE_WRAP_R) != paramValue) { FAIL_RETURN(pCurrent->SetTextureParameter(i, GL_TEXTURE_WRAP_R, paramValue)); - //glTexParameteri(eTarget, GL_TEXTURE_WRAP_R, paramValue); + glTexParameteri(eTarget, GL_TEXTURE_WRAP_R, paramValue); } //GLVU::CheckForGLError("SkyTextureState::Activate(2)"); paramValue = GetTextureParameter(i, GL_TEXTURE_MIN_FILTER); diff --git a/simgear/scene/sky/clouds3d/camera.hpp b/simgear/scene/sky/clouds3d/camera.hpp index 42a24c89..4be6d732 100644 --- a/simgear/scene/sky/clouds3d/camera.hpp +++ b/simgear/scene/sky/clouds3d/camera.hpp @@ -31,8 +31,8 @@ #define CAMERA #include -#include -#include +#include "vec3f.hpp" +#include "mat16fv.hpp" class Camera { diff --git a/simgear/scene/sky/clouds3d/mat44test.cpp b/simgear/scene/sky/clouds3d/mat44test.cpp index c99b809c..cdde7f33 100644 --- a/simgear/scene/sky/clouds3d/mat44test.cpp +++ b/simgear/scene/sky/clouds3d/mat44test.cpp @@ -21,8 +21,8 @@ // $Id$ //---------------------------------------------------------------------------- #include -#include -#include +#include "vec3f.hpp" +#include "mat44.hpp" int main(int argc, char *argv[]) {