Avoid many includes in mat.hxx, so ground testing code (e.g., Yasim) doesn't end up pulling in many OSG and scene classes.
#include <simgear/props/props_io.hxx>
#include <simgear/props/vectorPropTemplates.hxx>
#include <simgear/scene/model/model.hxx>
+#include <simgear/scene/material/matmodel.hxx>
#include <simgear/scene/util/RenderConstants.hxx>
#include <simgear/scene/util/StateAttributeFactory.hxx>
+#include <simgear/props/condition.hxx>
+#include <simgear/scene/util/SGSceneFeatures.hxx>
+#include <simgear/scene/tgdb/SGTexturedTriangleBin.hxx>
#include "Effect.hxx"
#include "Technique.hxx"
return _status[i].effect.get();
}
-Effect* SGMaterial::get_effect(SGTexturedTriangleBin triangleBin)
+Effect* SGMaterial::get_effect(const SGTexturedTriangleBin& triangleBin)
{
if (_status.size() == 0) {
SG_LOG( SG_GENERAL, SG_WARN, "No effect available.");
}
-osg::Texture2D* SGMaterial::get_object_mask(SGTexturedTriangleBin triangleBin)
+osg::Texture2D* SGMaterial::get_object_mask(const SGTexturedTriangleBin& triangleBin)
{
if (_status.size() == 0) {
SG_LOG( SG_GENERAL, SG_WARN, "No mask available.");
return it->second;
}
+bool SGMaterial::valid() const
+{
+ if (condition) {
+ return condition->test();
+ } else {
+ return true;
+ }
+}
+
\f
////////////////////////////////////////////////////////////////////////
// SGMaterialGlyph.
#ifndef _SG_MAT_HXX
#define _SG_MAT_HXX
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
#include <simgear/compiler.h>
#include <string> // Standard C++ string library
#include <map>
#include "Effect.hxx"
-#include <simgear/scene/tgdb/SGTexturedTriangleBin.hxx>
#include <osg/ref_ptr>
#include <osg/Texture2D>
class StateSet;
}
-#include <simgear/scene/util/SGReaderWriterOptions.hxx>
-#include <simgear/props/props.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
-#include <simgear/scene/util/SGSceneFeatures.hxx>
-#include <simgear/props/condition.hxx>
-
-#include "matmodel.hxx"
+#include <simgear/math/SGMath.hxx>
namespace simgear
{
class Effect;
void reload_shaders();
+class SGReaderWriterOptions;
}
+class SGMatModelGroup;
+class SGCondition;
+class SGPropertyNode;
class SGMaterialGlyph;
+class SGTexturedTriangleBin;
/**
* A material in the scene graph.
/**
* Get the textured state.
*/
- simgear::Effect* get_effect(SGTexturedTriangleBin triangleBin);
+ simgear::Effect* get_effect(const SGTexturedTriangleBin& triangleBin);
simgear::Effect* get_effect();
/**
* Get the textured state.
*/
- osg::Texture2D* get_object_mask(SGTexturedTriangleBin triangleBin);
+ osg::Texture2D* get_object_mask(const SGTexturedTriangleBin& triangleBin);
/**
* Evaluate whether this material is valid given the current global
* property state.
*/
- bool valid() {
- if (condition) {
- return condition->test();
- } else {
- return true;
- }
- }
+ bool valid() const;
/**
* Return pointer to glyph class, or 0 if it doesn't exist.
#include <simgear/misc/sgstream.hxx>
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include <simgear/scene/util/RenderConstants.hxx>
+#include <simgear/scene/util/OsgMath.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/scene/material/matlib.hxx>
#include <simgear/scene/tgdb/apt_signs.hxx>
#ifndef SG_MAT_MODEL_BIN_HXX
#define SG_MAT_MODEL_BIN_HXX
-#include <math.h>
+#include <vector>
+#include <simgear/math/SGMath.hxx>
+// forward decls
+class SGMatModel;
+
class SGMatModelBin {
public:
struct MatModel {
#include <simgear/scene/material/EffectGeode.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/scene/material/matlib.hxx>
-
+#include <simgear/scene/util/OsgMath.hxx>
#include <simgear/scene/util/VectorArrayAdapter.hxx>
#include <simgear/scene/util/SGNodeMasks.hxx>
osg::Geometry* buildGeometry() const
{ return buildGeometry(getTriangles()); }
- int getTextureIndex() {
+ int getTextureIndex() const
+ {
if (empty() || getNumTriangles() == 0)
return 0;
#include <simgear/scene/material/EffectGeode.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/scene/material/matlib.hxx>
+#include <simgear/scene/util/OsgMath.hxx>
#include "apt_signs.hxx"
#include <simgear/scene/material/Effect.hxx>
#include <simgear/scene/material/EffectGeode.hxx>
#include <simgear/scene/material/mat.hxx>
+#include <simgear/scene/material/matmodel.hxx>
#include <simgear/scene/material/matlib.hxx>
#include <simgear/scene/model/SGOffsetTransform.hxx>
#include <simgear/scene/util/SGUpdateVisitor.hxx>
#include <simgear/scene/util/SGNodeMasks.hxx>
#include <simgear/scene/util/QuadTreeBuilder.hxx>
+#include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include "SGTexturedTriangleBin.hxx"
#include "SGLightBin.hxx"