From Liang Aibin:
"1. Location: <OSG_SOURCE_ROOT>\src\osgPlugins\osg\Fog.cpp Reason: ".osg" writter plugins output incorrected string for osg::Fog's Mode. How to Fix: Line 138 in Fog.cpp: case(Fog::LINEAR): return "NERVER"; Change to: case(Fog::LINEAR): return "LINEAR"; 2. Location: <OSG_SOURCE_ROOT>\src\osgPlugins\ive\ Reason: ".ive" writter plugins missing to process "osg::Fog". How to Fix: (1). Line 86 in ReadWrite.h: Add: #define IVEFOG 0x00001133 (2). In CMakeLists.txt "SET(TARGET_SRC" section Add: Fog.cpp "SET(TARGET_H" section Add: Fog.h (3). In DataInputStream.cpp Line 54,Add: #include "Fog.h" Line 1185,Add: else if(attributeID == IVEFOG){ attribute = new osg::Fog(); ((ive::Fog*)(attribute))->read(this); } (4). In DataOutputStream.cpp Line 57,Add: #include "Fog.h" Line 832,Add: // This is a Fog else if(dynamic_cast<const osg::Fog*>(attribute)){ ((ive::Fog*)(attribute))->write(this); } (5). Add newly created ive::Fog Object in Fog.h and Fog.cpp. "
This commit is contained in:
parent
0a0034aebb
commit
45fcb25765
@ -3,8 +3,8 @@
|
||||
|
||||
SET(TARGET_SRC
|
||||
AlphaFunc.cpp
|
||||
AnimationPath.cpp
|
||||
AnimationPathCallback.cpp
|
||||
AnimationPath.cpp
|
||||
AutoTransform.cpp
|
||||
AzimElevationSector.cpp
|
||||
AzimSector.cpp
|
||||
@ -18,44 +18,50 @@ SET(TARGET_SRC
|
||||
ClipPlane.cpp
|
||||
ClusterCullingCallback.cpp
|
||||
ColorMask.cpp
|
||||
CompositeLayer.cpp
|
||||
ConeSector.cpp
|
||||
ConvexPlanarOccluder.cpp
|
||||
ConvexPlanarPolygon.cpp
|
||||
CoordinateSystemNode.cpp
|
||||
CullFace.cpp
|
||||
DOFTransform.cpp
|
||||
DataInputStream.cpp
|
||||
DataOutputStream.cpp
|
||||
Depth.cpp
|
||||
DirectionalSector.cpp
|
||||
DOFTransform.cpp
|
||||
Drawable.cpp
|
||||
DrawArrayLengths.cpp
|
||||
DrawArrays.cpp
|
||||
DrawElementsUByte.cpp
|
||||
DrawElementsUInt.cpp
|
||||
DrawElementsUShort.cpp
|
||||
Drawable.cpp
|
||||
ElevationSector.cpp
|
||||
EllipsoidModel.cpp
|
||||
Exception.cpp
|
||||
Fog.cpp
|
||||
FragmentProgram.cpp
|
||||
FrontFace.cpp
|
||||
Geode.cpp
|
||||
Geometry.cpp
|
||||
Group.cpp
|
||||
HeightFieldLayer.cpp
|
||||
Image.cpp
|
||||
ImageLayer.cpp
|
||||
Impostor.cpp
|
||||
LOD.cpp
|
||||
Layer.cpp
|
||||
Light.cpp
|
||||
LightModel.cpp
|
||||
LightPoint.cpp
|
||||
LightPointNode.cpp
|
||||
LightSource.cpp
|
||||
LineWidth.cpp
|
||||
Locator.cpp
|
||||
LOD.cpp
|
||||
Material.cpp
|
||||
MatrixTransform.cpp
|
||||
Multisample.cpp
|
||||
MultiSwitch.cpp
|
||||
MultiTextureControl.cpp
|
||||
Multisample.cpp
|
||||
Node.cpp
|
||||
Object.cpp
|
||||
OccluderNode.cpp
|
||||
@ -79,24 +85,19 @@ SET(TARGET_SRC
|
||||
StateSet.cpp
|
||||
Stencil.cpp
|
||||
Switch.cpp
|
||||
TexEnv.cpp
|
||||
TerrainTile.cpp
|
||||
TexEnvCombine.cpp
|
||||
TexEnv.cpp
|
||||
TexGen.cpp
|
||||
TexGenNode.cpp
|
||||
TexMat.cpp
|
||||
Text.cpp
|
||||
Texture.cpp
|
||||
Texture1D.cpp
|
||||
Texture2D.cpp
|
||||
Texture3D.cpp
|
||||
Texture.cpp
|
||||
TextureCubeMap.cpp
|
||||
TextureRectangle.cpp
|
||||
TerrainTile.cpp
|
||||
Locator.cpp
|
||||
Layer.cpp
|
||||
HeightFieldLayer.cpp
|
||||
ImageLayer.cpp
|
||||
CompositeLayer.cpp
|
||||
Transform.cpp
|
||||
Uniform.cpp
|
||||
VertexProgram.cpp
|
||||
@ -105,8 +106,8 @@ SET(TARGET_SRC
|
||||
)
|
||||
SET(TARGET_H
|
||||
AlphaFunc.h
|
||||
AnimationPath.h
|
||||
AnimationPathCallback.h
|
||||
AnimationPath.h
|
||||
AutoTransform.h
|
||||
AzimElevationSector.h
|
||||
AzimSector.h
|
||||
@ -120,41 +121,47 @@ SET(TARGET_H
|
||||
ClipPlane.h
|
||||
ClusterCullingCallback.h
|
||||
ColorMask.h
|
||||
CompositeLayer.h
|
||||
ConeSector.h
|
||||
ConvexPlanarOccluder.h
|
||||
ConvexPlanarPolygon.h
|
||||
CoordinateSystemNode.h
|
||||
CullFace.h
|
||||
DOFTransform.h
|
||||
DataInputStream.h
|
||||
DataOutputStream.h
|
||||
DataTypeSize.h
|
||||
Depth.h
|
||||
DirectionalSector.h
|
||||
DOFTransform.h
|
||||
Drawable.h
|
||||
DrawArrayLengths.h
|
||||
DrawArrays.h
|
||||
DrawElementsUByte.h
|
||||
DrawElementsUInt.h
|
||||
DrawElementsUShort.h
|
||||
Drawable.h
|
||||
ElevationSector.h
|
||||
EllipsoidModel.h
|
||||
Exception.h
|
||||
Fog.h
|
||||
FragmentProgram.h
|
||||
FrontFace.h
|
||||
Geode.h
|
||||
Geometry.h
|
||||
Group.h
|
||||
HeightFieldLayer.h
|
||||
Image.h
|
||||
ImageLayer.h
|
||||
Impostor.h
|
||||
IveVersion.h
|
||||
LOD.h
|
||||
Layer.h
|
||||
Light.h
|
||||
LightModel.h
|
||||
LightPoint.h
|
||||
LightPointNode.h
|
||||
LightSource.h
|
||||
LineWidth.h
|
||||
Locator.h
|
||||
LOD.h
|
||||
Material.h
|
||||
MatrixTransform.h
|
||||
MultiSwitch.h
|
||||
@ -177,30 +184,25 @@ SET(TARGET_H
|
||||
Sequence.h
|
||||
ShadeModel.h
|
||||
Shader.h
|
||||
Shape.h
|
||||
ShapeDrawable.h
|
||||
Shape.h
|
||||
StateSet.h
|
||||
Stencil.h
|
||||
Switch.h
|
||||
TexEnv.h
|
||||
TerrainTile.h
|
||||
TexEnvCombine.h
|
||||
TexEnv.h
|
||||
TexGen.h
|
||||
TexGenNode.h
|
||||
TexMat.h
|
||||
Text.h
|
||||
Texture.h
|
||||
Texture1D.h
|
||||
Texture2D.h
|
||||
Texture3D.h
|
||||
TextureCubeMap.h
|
||||
Texture.h
|
||||
TextureRectangle.h
|
||||
TerrainTile.h
|
||||
Transform.h
|
||||
Locator.h
|
||||
Layer.h
|
||||
HeightFieldLayer.h
|
||||
ImageLayer.h
|
||||
CompositeLayer.h
|
||||
Uniform.h
|
||||
VertexProgram.h
|
||||
Viewport.h
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "Image.h"
|
||||
#include "PointSprite.h"
|
||||
#include "Multisample.h"
|
||||
#include "Fog.h"
|
||||
|
||||
|
||||
#include "Group.h"
|
||||
@ -1181,6 +1182,10 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
attribute = new osg::Stencil();
|
||||
((ive::Stencil*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVEFOG){
|
||||
attribute = new osg::Fog();
|
||||
((ive::Fog*)(attribute))->read(this);
|
||||
}
|
||||
else{
|
||||
throw Exception("Unknown StateAttribute in StateSet::read()");
|
||||
}
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "Image.h"
|
||||
#include "PointSprite.h"
|
||||
#include "Multisample.h"
|
||||
#include "Fog.h"
|
||||
|
||||
#include "Group.h"
|
||||
#include "MatrixTransform.h"
|
||||
@ -828,6 +829,10 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
else if(dynamic_cast<const osg::Multisample*>(attribute)){
|
||||
((ive::Multisample*)(attribute))->write(this);
|
||||
}
|
||||
// This is a Fog
|
||||
else if(dynamic_cast<const osg::Fog*>(attribute)){
|
||||
((ive::Fog*)(attribute))->write(this);
|
||||
}
|
||||
|
||||
else{
|
||||
std::string className = attribute->className();
|
||||
|
67
src/osgPlugins/ive/Fog.cpp
Normal file
67
src/osgPlugins/ive/Fog.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: Fog.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::Fog in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Liang Aibin
|
||||
*
|
||||
* HISTORY: Created 17.06.2008
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Fog.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void Fog::write(DataOutputStream* out){
|
||||
|
||||
// write Fog's identification
|
||||
out->writeInt(IVEFOG);
|
||||
|
||||
// if the osg class is inherited by any other class we should also write this to file
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj)
|
||||
((ive::Object*)(obj))->write(out);
|
||||
else
|
||||
throw Exception("Fog::write(): Could not cast this osg::Fog to an osg::Object.");
|
||||
|
||||
// write Fog's properties
|
||||
out->writeInt(getMode());
|
||||
out->writeFloat(getDensity());
|
||||
out->writeFloat(getStart());
|
||||
out->writeFloat(getEnd());
|
||||
out->writeVec4(getColor());
|
||||
out->writeInt(getFogCoordinateSource());
|
||||
}
|
||||
|
||||
void Fog::read(DataInputStream* in){
|
||||
|
||||
// peek on Fog's identification
|
||||
int id = in->peekInt();
|
||||
if(id == IVEFOG)
|
||||
{
|
||||
// read Fog's identification
|
||||
id = in->readInt();
|
||||
|
||||
// if the osg class is inherited by any other class we should also read this from file
|
||||
osg::Object* obj = dynamic_cast<osg::Object*>(this);
|
||||
if(obj)
|
||||
((ive::Object*)(obj))->read(in);
|
||||
else
|
||||
throw Exception("Fog::read(): Could not cast this osg::Fog to an osg::Object.");
|
||||
|
||||
// Read Fog's properties
|
||||
setMode(osg::Fog::Mode(in->readInt()));
|
||||
setDensity(in->readFloat());
|
||||
setStart(in->readFloat());
|
||||
setEnd(in->readFloat());
|
||||
setColor(in->readVec4());
|
||||
setFogCoordinateSource(in->readInt());
|
||||
}
|
||||
else{
|
||||
throw Exception("Fog::read(): Expected Fog identification.");
|
||||
}
|
||||
}
|
15
src/osgPlugins/ive/Fog.h
Normal file
15
src/osgPlugins/ive/Fog.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef IVE_FOG
|
||||
#define IVE_FOG 1
|
||||
|
||||
#include <osg/Fog>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class Fog : public osg::Fog, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -83,6 +83,7 @@ namespace ive {
|
||||
#define IVETEXTURERECTANGLE 0x00001130
|
||||
#define IVEPOINTSPRITE 0x00001131
|
||||
#define IVEMULTISAMPLE 0x00001132
|
||||
#define IVEFOG 0x00001133
|
||||
|
||||
// Drawables
|
||||
#define IVEDRAWABLE 0x00001000
|
||||
|
@ -135,7 +135,7 @@ const char* Fog_getModeStr(Fog::Mode mode)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case(Fog::LINEAR): return "NEVER";
|
||||
case(Fog::LINEAR): return "LINEAR";
|
||||
case(Fog::EXP): return "EXP";
|
||||
case(Fog::EXP2): return "EXP2";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user