1 // userdata.hxx -- two classes for populating ssg user data slots in association
2 // with our implimenation of random surface objects.
4 // Written by David Megginson, started December 2001.
6 // Copyright (C) 2001 - 2003 Curtis L. Olson - curt@flightgear.org
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef _SG_USERDATA_HXX
26 #define _SG_USERDATA_HXX
28 #include <simgear/compiler.h>
38 class SGMatModelGroup;
44 * the application must call sgUserDataInit() and specify the
45 * following values (needed by the model loader callback at draw time)
46 * before drawing any scenery.
48 void sgUserDataInit( SGModelLib *m, const string &r,
49 SGPropertyNode *p, double t );
53 * User data for populating leaves when they come in range.
55 class SGLeafUserData : public ssgBase
67 void setup_triangle( int i );
72 * User data for populating triangles when they come in range.
74 class SGTriUserData : public ssgBase
83 SGMatModelGroup * object_group;
85 SGLeafUserData * leafData;
88 void fill_in_triangle();
89 void add_object_to_triangle(SGMatModel * object);
90 void makeWorldMatrix (sgMat4 ROT, double hdg_deg );
95 * ssgEntity with a dummy bounding sphere, to fool culling.
97 * This forces the in-range and out-of-range branches to be visited
98 * when appropriate, even if they have no children. It's ugly, but
99 * it works and seems fairly efficient (since branches can still
100 * be culled when they're out of the view frustum).
102 class SGDummyBSphereEntity : public ssgBranch
105 SGDummyBSphereEntity (float radius)
107 bsphere.setCenter(0, 0, 0);
108 bsphere.setRadius(radius);
110 virtual ~SGDummyBSphereEntity () {}
111 virtual void recalcBSphere () { bsphere_is_invalid = false; }
115 #endif // _SG_USERDATA_HXX