Refactor mat.hxx header.
Avoid many includes in mat.hxx, so ground testing code (e.g., Yasim) doesn't end up pulling in many OSG and scene classes.
This commit is contained in:
parent
b93661508e
commit
e99064ca18
@ -54,8 +54,12 @@
|
||||
#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"
|
||||
@ -448,7 +452,7 @@ Effect* SGMaterial::get_effect(int i)
|
||||
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.");
|
||||
@ -465,7 +469,7 @@ Effect* SGMaterial::get_effect()
|
||||
}
|
||||
|
||||
|
||||
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.");
|
||||
@ -541,6 +545,15 @@ SGMaterialGlyph* SGMaterial::get_glyph (const string& name) const
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool SGMaterial::valid() const
|
||||
{
|
||||
if (condition) {
|
||||
return condition->test();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// SGMaterialGlyph.
|
||||
|
@ -26,10 +26,6 @@
|
||||
#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
|
||||
@ -37,7 +33,6 @@
|
||||
#include <map>
|
||||
|
||||
#include "Effect.hxx"
|
||||
#include <simgear/scene/tgdb/SGTexturedTriangleBin.hxx>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Texture2D>
|
||||
@ -47,21 +42,21 @@ namespace osg
|
||||
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.
|
||||
@ -109,13 +104,13 @@ public:
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
/**
|
||||
@ -311,13 +306,7 @@ public:
|
||||
* 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.
|
||||
|
@ -39,6 +39,7 @@
|
||||
#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>
|
||||
|
@ -22,8 +22,12 @@
|
||||
#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 {
|
||||
|
@ -41,7 +41,7 @@
|
||||
#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>
|
||||
|
||||
|
@ -361,7 +361,8 @@ public:
|
||||
osg::Geometry* buildGeometry() const
|
||||
{ return buildGeometry(getTriangles()); }
|
||||
|
||||
int getTextureIndex() {
|
||||
int getTextureIndex() const
|
||||
{
|
||||
if (empty() || getNumTriangles() == 0)
|
||||
return 0;
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#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"
|
||||
|
||||
|
@ -52,11 +52,13 @@
|
||||
#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"
|
||||
|
Loading…
Reference in New Issue
Block a user