1
0
Fork 0

Updated from Norman to hack on clouds ... some progress.

This commit is contained in:
curt 2002-09-18 14:57:20 +00:00
parent bb4fe6907f
commit c5f7f15f5b
5 changed files with 44 additions and 31 deletions

View file

@ -98,7 +98,8 @@ fgfs-manual-zip:
fgfs-win32-bin:
(cd $(HOME); \
zip -r fgfs-win32-bin-$(VERSION).zip FlightGear/bin )
zip -r fgfs-win32-bin-$(VERSION).zip FlightGear/runfgfs.bat \
FlightGear/bin/Win32 )
# make the win32-libs distribution (depricated)
win32-libs:

View file

@ -645,6 +645,15 @@ void fgInitFDM() {
}
}
static void printMat(const sgVec4 *mat, char *name="")
{
int i;
cout << name << endl;
for(i=0; i<4; i++) {
cout <<" "<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<endl;
}
cout << endl;
}
// Initialize view parameters
void fgInitView() {
@ -652,6 +661,11 @@ void fgInitView() {
globals->get_aircraft_model()->update(0);
// run update for current view so that data is current...
globals->get_viewmgr()->update(0);
printMat(globals->get_current_view()->get_VIEW(),"VIEW");
printMat(globals->get_current_view()->get_UP(),"UP");
// printMat(globals->get_current_view()->get_LOCAL(),"LOCAL");
}
@ -896,16 +910,17 @@ bool fgInitSubsystems( void ) {
////////////////////////////////////////////////////////////////////
// Initialize the 3D cloud subsystem.
////////////////////////////////////////////////////////////////////
if ( fgGetBool("/sim/rendering/clouds3d") ) {
SGPath cloud_path(globals->get_fg_root());
cloud_path.append("large.sky");
SG_LOG(SG_GENERAL, SG_INFO, "Loading CLOUDS3d from: " << cloud_path.c_str());
if ( !sgCloud3d->Load( cloud_path.str() ) ) {
fgSetBool("/sim/rendering/clouds3d", false);
SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d FAILED: ");
}
SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d Loaded: ");
}
////////////////////////////////////////////////////////////////////
// Initialize vor/ndb/ils/fix list management and query systems
////////////////////////////////////////////////////////////////////

View file

@ -391,11 +391,6 @@ void trRenderFrame( void ) {
globals->get_model_mgr()->draw();
globals->get_aircraft_model()->draw();
// need to do this here as hud_and_panel state is static to
// main.cxx and HUD and Panel routines have to be called with
// knowledge of the the TR struct < see gui.cxx::HighResDump()
hud_and_panel->apply();
}
@ -454,18 +449,6 @@ void fgRenderFrame() {
// calculate our current position in cartesian space
globals->get_scenery()->set_center( globals->get_scenery()->get_next_center() );
// do it here. at init time the clouds are loaded BEFORE our position is known
if ( fgGetBool("/sim/rendering/clouds3d") ) {
if ( _bcloud_orig ) {
// cloud center can be anywhere in fgfs coordinates, but the tile
// cener is a good place as we'll have some visible when starting
posit = globals->get_scenery()->get_center();
sgClouds3d->Set_Cloud_Orig( _posit );
_bcloud_orig = false;
}
sgClouds3d->Update( current__view->get_absolute_view_pos() );
}
// update view port
fgReshape( fgGetInt("/sim/startup/xsize"),
fgGetInt("/sim/startup/ysize") );
@ -492,6 +475,15 @@ void fgRenderFrame() {
}
glClear( clear_mask );
if ( fgGetBool("/sim/rendering/clouds3d") ) {
posit = globals->get_scenery()->get_center();
if ( _bcloud_orig ) {
sgClouds3d->Set_Cloud_Orig( _posit );
_bcloud_orig = false;
}
sgClouds3d->Update( current__view->get_absolute_view_pos() );
}
// Tell GL we are switching to model view parameters
// I really should create a derived ssg node or use a call
@ -765,15 +757,6 @@ void fgRenderFrame() {
globals->get_model_mgr()->draw();
globals->get_aircraft_model()->draw();
// draw the 3D clouds
if ( fgGetBool("/sim/rendering/clouds3d") ) {
//glPushAttrib(GL_ALL_ATTRIB_BITS);
// transform the current view matrix with camera offset position
sgClouds3d->Draw( (sgVec4 *)current__view->get_VIEW() );
//sgClouds3d->Draw();
//glPopAttrib();
}
// display HUD && Panel
glDisable( GL_FOG );
glDisable( GL_DEPTH_TEST );
@ -804,7 +787,15 @@ void fgRenderFrame() {
puDisplay();
// glDisable ( GL_BLEND ) ;
// glEnable( GL_FOG );
if ( fgGetBool("/sim/rendering/clouds3d") ) {
// cout << "drawing new clouds" << endl;
// set the opengl state to known default values
// default_state->force();
sgClouds3d->Draw((sgVec4 *)current__view->get_VIEW());
}
glEnable( GL_DEPTH_TEST );
glEnable( GL_FOG );
globals->get_logger()->update(delta_time_sec);
}

View file

@ -318,6 +318,8 @@ FGNewMat::read_properties (const SGPropertyNode * props)
emission[2] = props->getDoubleValue("emissive/b", 0.0);
emission[3] = props->getDoubleValue("emissive/a", 0.0);
shininess = props->getDoubleValue("shininess", 0.0);
vector<SGPropertyNode_ptr> object_group_nodes =
((SGPropertyNode *)props)->getChildren("object-group");
for (unsigned int i = 0; i < object_group_nodes.size(); i++)
@ -345,6 +347,7 @@ FGNewMat::init ()
light_coverage = 0.0;
texture_loaded = false;
refcount = 0;
shininess = 0.0;
for (int i = 0; i < 4; i++)
ambient[i] = diffuse[i] = specular[i] = emission[i] = 0.0;
}
@ -416,10 +419,10 @@ FGNewMat::build_ssg_state (bool defer_tex_load)
textured->setMaterial ( GL_SPECULAR,
specular[0], specular[1],
specular[2], specular[3] ) ;
textured->setShininess( 75.0 );
textured->setMaterial ( GL_EMISSION,
emission[0], emission[1],
emission[2], emission[3] ) ;
textured->setShininess ( shininess );
#endif
// Set up the coloured state
@ -443,6 +446,7 @@ FGNewMat::build_ssg_state (bool defer_tex_load)
nontextured->setMaterial ( GL_EMISSION,
emission[0], emission[1],
emission[2], emission[3] ) ;
nontextured->setShininess ( shininess );
state->setStep( 0, textured ); // textured
state->setStep( 1, nontextured ); // untextured
@ -489,6 +493,7 @@ void FGNewMat::set_ssg_state( ssgSimpleState *s )
nontextured->setMaterial ( GL_EMISSION,
emission[0], emission[1],
emission[2], emission[3] ) ;
nontextured->setShininess ( shininess );
state->setStep( 0, textured ); // textured
state->setStep( 1, nontextured ); // untextured

View file

@ -381,6 +381,7 @@ private:
// material properties
sgVec4 ambient, diffuse, specular, emission;
double shininess;
// true if texture loading deferred, and not yet loaded
bool texture_loaded;