* @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.");
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;
}
//------------------------------------------------------------------------------
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;
#ifndef __SKYBOUNDINGVOLUME_HPP__
#define __SKYBOUNDINGVOLUME_HPP__
-#include <vec3f.hpp>
-#include <mat44.hpp>
+#include "vec3f.hpp"
+#include "mat44.hpp"
// forward to reduce unnecessary dependencies
class Camera;
_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;
// 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 );
Rotate( rot_mat );
- moveit.Set( 0.0, 0.0, 4050.0 );
+ moveit.Set( 1000.0, 0.0, 4050.0 );
Translate( moveit );
#define __SKYRENDERABLEINSTANCE_HPP__
#include <vector>
-#include <mat33.hpp>
-#include <mat44.hpp>
+#include "mat33.hpp"
+#include "mat44.hpp"
#include "SkyUtil.hpp"
// forward to reduce unnecessary dependencies
FAIL_RETURN(archive.FindString("CloudFile", &pFilename, i));\r
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));
}
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));
}
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]);
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;
#include "SkyRenderable.hpp"
#include "SkyRenderableInstance.hpp"
#include "SkyRenderableInstanceCloud.hpp"
-//#include "SkyHeavens.hpp"
-//#include "SkyHeightField.hpp"
#include "camutils.hpp"
#include <algorithm>
SkyArchive subArchive;
//iNumClouds = 5; //set this value to reduce cloud field for debugging
for (int i = 0; i < iNumClouds; ++i)
- {\rprintf("Loading # %d of %d clouds\n", i, iNumClouds);
+ {\rprintf("Loading # %d of %d clouds\n", i+1, iNumClouds);
cloudArchive.FindArchive("Cloud", &subArchive, i);
SkyCloud *pCloud = new SkyCloud();
pCloud->Load(subArchive, rScale);
* 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;
- }*/
+ } */
}
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);
#define CAMERA
#include <stdio.h>
-#include <vec3f.hpp>
-#include <mat16fv.hpp>
+#include "vec3f.hpp"
+#include "mat16fv.hpp"
class Camera
{
// $Id$
//----------------------------------------------------------------------------
#include <iostream.h>
-#include <vec3f.hpp>
-#include <mat44.hpp>
+#include "vec3f.hpp"
+#include "mat44.hpp"
int main(int argc, char *argv[])
{