//
// Written by Harald JOHNSEN, started May 2005.
//
-// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
+// Copyright (C) 2005 Harald JOHNSEN
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
void FGODGauge::endCapture(GLuint texID) {
glBindTexture(GL_TEXTURE_2D, texID);
+ // don't use mimaps if we don't update them
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureWH, textureWH);
if(rtAvailable)
rt->EndCapture();
else
set3D();
+ glBindTexture(GL_TEXTURE_2D, 0);
}
void FGODGauge::setSize(int viewSize) {
/**
* Locate a texture SSG node in a branch.
*/
-static ssgTexture *
+static const char *strip_path(const char *name) {
+ /* Remove all leading path information. */
+ const char* seps = "\\/" ;
+ const char* fn = & name [ strlen ( name ) - 1 ] ;
+ for ( ; fn != name && strchr(seps,*fn) == NULL ; fn-- )
+ /* Search back for a seperator */ ;
+ if ( strchr(seps,*fn) != NULL )
+ fn++ ;
+ return fn ;
+}
+
+static ssgSimpleState *
find_texture_node (ssgEntity * node, const char * name)
{
- if( node->isA( ssgTypeTexture() ) ) {
- ssgTexture *tex = (ssgTexture *) node;
- char * texture_name = tex->getFilename();
- if (texture_name != 0 && !strcmp(name, texture_name))
- return tex;
+ if( node->isAKindOf( ssgTypeLeaf() ) ) {
+ ssgLeaf *leaf = (ssgLeaf *) node;
+ ssgSimpleState *state = (ssgSimpleState *) leaf->getState();
+ if( state ) {
+ ssgTexture *tex = state->getTexture();
+ if( tex ) {
+ const char * texture_name = tex->getFilename();
+ if (texture_name) {
+ texture_name = strip_path( texture_name );
+ if ( !strcmp(name, texture_name) )
+ return state;
+ }
+ }
+ }
}
- else if (node->isAKindOf(ssgTypeBranch())) {
+ else {
int nKids = node->getNumKids();
for (int i = 0; i < nKids; i++) {
- ssgTexture * result =
+ ssgSimpleState * result =
find_texture_node(((ssgBranch*)node)->getKid(i), name);
if (result != 0)
return result;
void FGODGauge::set_texture(const char * name, GLuint new_texture) {
ssgEntity * root = globals->get_scenery()->get_aircraft_branch();
- ssgTexture * node = find_texture_node( root, name );
+ name = strip_path( name );
+ ssgSimpleState * node = find_texture_node( root, name );
if( node )
- node->setHandle( new_texture );
+ node->setTexture( new_texture );
}
void FGODGauge::set2D() {
//
// Written by Harald JOHNSEN, started May 2005.
//
-// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
+// Copyright (C) 2005 Harald JOHNSEN
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
odg->set_texture( odgauge_name, resultTexture->getHandle());
last_switchKnob = switchKnob;
}
+ FGViewer *current__view = globals->get_current_view();
+ if( current__view->getInternal() &&
+ (current__view->getHeadingOffset_deg() <= 15.0 || current__view->getHeadingOffset_deg() >= 345.0) &&
+ (current__view->getPitchOffset_deg() <= 15.0 || current__view->getPitchOffset_deg() >= 350.0) ) {
+
+ // we don't update the radar echo if the pilot looks around
+ // this is a copy
+ radarEchoBuffer = *sgEnviro.get_radar_echo();
+ }
odg->beginCapture(256);
odg->Clear();
+
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
const float rot_x = cos ( view_heading );
const float rot_y = sin ( view_heading );
- list_of_SGWxRadarEcho *radarEcho = sgEnviro.get_radar_echo();
+ list_of_SGWxRadarEcho *radarEcho = &radarEchoBuffer;
list_of_SGWxRadarEcho::iterator iradarEcho;
const float LWClevel[] = { 0.1f, 0.5f, 2.1f };
const float symbolSize = 1.0f / 8.0f ;