/usr/include/simgear/scene/material/matmodel.hxx is in libsimgear-dev 3.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | // matmodel.hxx -- class to handle models tied to a material property
//
// Written by David Megginson, December 2001
//
// Copyright (C) 1998 - 2003 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef _SG_MAT_MODEL_HXX
#define _SG_MAT_MODEL_HXX
#ifndef __cplusplus
# error This library requires C++
#endif
#include <simgear/compiler.h>
#include <string> // Standard C++ string library
#include <vector>
#include <osg/ref_ptr>
#include <osg/Node>
#include <osg/NodeVisitor>
#include <osg/Billboard>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/props/props.hxx>
#include <simgear/math/sg_random.h>
class SGMatModelGroup;
/**
* A randomly-placeable object.
*
* SGMaterial uses this class to keep track of the model(s) and
* parameters for a single instance of a randomly-placeable object.
* The object can have more than one variant model (i.e. slightly
* different shapes of trees), but they are considered equivalent
* and interchangeable.
*/
class SGMatModel : public SGReferenced {
public:
/**
* The heading type for a randomly-placed object.
*/
enum HeadingType {
HEADING_FIXED,
HEADING_BILLBOARD,
HEADING_RANDOM,
HEADING_MASK
};
/**
* Get the number of variant models available for the object.
*
* @return The number of variant models.
*/
int get_model_count( SGPropertyNode *prop_root );
/**
* Get a randomly-selected variant model for the object.
*
* @return A randomly select model from the variants.
*/
osg::Node *get_random_model( SGPropertyNode *prop_root, mt *seed );
/**
* Get the average number of meters^2 occupied by each instance.
*
* @return The coverage in meters^2.
*/
double get_coverage_m2 () const;
/**
* Get the visual range of the object in meters.
*
* @return The visual range.
*/
double get_range_m () const;
/**
* Get the minimum spacing between this and any
* other objects in m
*
* @return The spacing in m.
*/
double get_spacing_m () const;
/**
* Get a randomized visual range
*
* @return a randomized visual range
*/
double get_randomized_range_m(mt* seed) const;
/**
* Get the heading type for the object.
*
* @return The heading type.
*/
HeadingType get_heading_type () const;
virtual ~SGMatModel ();
protected:
friend class SGMatModelGroup;
SGMatModel (const SGPropertyNode * node, double range_m);
private:
/**
* Actually load the models.
*
* This class uses lazy loading so that models won't be held
* in memory for materials that are never referenced.
*/
void load_models( SGPropertyNode *prop_root );
std::vector<std::string> _paths;
mutable std::vector<osg::ref_ptr<osg::Node> > _models;
mutable bool _models_loaded;
double _coverage_m2;
double _spacing_m;
double _range_m;
HeadingType _heading_type;
};
/**
* A collection of related objects with the same visual range.
*
* Grouping objects with the same range together significantly
* reduces the memory requirements of randomly-placed objects.
* Each SGMaterial instance keeps a (possibly-empty) list of
* object groups for placing randomly on the scenery.
*/
class SGMatModelGroup : public SGReferenced {
public:
virtual ~SGMatModelGroup ();
/**
* Get the visual range of the object in meters.
*
* @return The visual range.
*/
double get_range_m () const;
/**
* Get the number of objects in the group.
*
* @return The number of objects.
*/
int get_object_count () const;
/**
* Get a specific object.
*
* @param index The object's index, zero-based.
* @return The object selected.
*/
SGMatModel * get_object (int index) const;
protected:
friend class SGMaterial;
SGMatModelGroup (SGPropertyNode * node);
private:
double _range_m;
std::vector<SGSharedPtr<SGMatModel> > _objects;
};
#endif // _SG_MAT_MODEL_HXX
|