From Stanislav Blinov, addition of LightModel support for .ive format.

This commit is contained in:
Robert Osfield
2004-09-09 13:07:18 +00:00
parent 39a79a9805
commit 217fa3ec0e
5 changed files with 30 additions and 2 deletions

View File

@@ -232,6 +232,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Light.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LightModel.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LightPoint.cpp
# End Source File
# Begin Source File
@@ -512,6 +516,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\Light.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LightModel.h
# End Source File
# Begin Source File
SOURCE=..\..\..\src\osgPlugins\ive\LightPoint.h
# End Source File
# Begin Source File

View File

@@ -2,13 +2,15 @@
*
* FILE: DataInputStream.cpp
*
* DESCRIPTION: Implements methods to read simpel datatypes from an
* DESCRIPTION: Implements methods to read simple datatypes from an
* input stream.
*
* CREATED BY: Rune Schmidt Jensen
*
* HISTORY: Created 11.03.2003
* Updated for texture1D by Don Burns, 27.1.2004
* Updated for light model - Stan Blinov at 25 august 7512 from World Creation (7.09.2004)
*
*
* Copyright 2003 VR-C
**********************************************************************/
@@ -32,6 +34,7 @@
#include "TexMat.h"
#include "FragmentProgram.h"
#include "VertexProgram.h"
#include "LightModel.h"
#include "Group.h"
#include "MatrixTransform.h"
@@ -682,6 +685,12 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
attribute = new osg::VertexProgram();
((ive::VertexProgram*)(attribute))->read(this);
}
else if(attributeID == IVELIGHTMODEL){
attribute = new osg::LightModel();
((ive::LightModel*)(attribute))->read(this);
}
else{
throw Exception("Unknown StateAttribute in StateSet::read()");
}

View File

@@ -2,13 +2,14 @@
*
* FILE: DataOutputStream.cpp
*
* DESCRIPTION: Implements methods to write simpel datatypes to an
* DESCRIPTION: Implements methods to write simple datatypes to an
* output stream.
*
* CREATED BY: Rune Schmidt Jensen
*
* HISTORY: Created 11.03.2003
* Updated for 1D textures - Don Burns 27.1.2004
* Updated for light model - Stan Blinov at 25 august 7512 from World Creation (7.09.2004)
*
* Copyright 2003 VR-C
**********************************************************************/
@@ -34,6 +35,8 @@
#include "TexMat.h"
#include "FragmentProgram.h"
#include "VertexProgram.h"
#include "LightModel.h"
#include "Group.h"
#include "MatrixTransform.h"
@@ -480,6 +483,12 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
else if(dynamic_cast<const osg::VertexProgram*>(attribute)){
((ive::VertexProgram*)(attribute))->write(this);
}
// This is a LightModel
else if(dynamic_cast<const osg::LightModel*>(attribute)){
((ive::LightModel*)(attribute))->write(this);
}
else{
std::string className = attribute->className();
throw Exception(std::string("StateSet::write(): Unknown StateAttribute: ").append(className));

View File

@@ -31,6 +31,7 @@ CXXFILES =\
LOD.cpp\
Light.cpp\
LightSource.cpp\
LightModel.cpp\
Material.cpp\
MatrixTransform.cpp\
MultiSwitch.cpp\

View File

@@ -58,6 +58,7 @@ namespace ive {
#define IVELINEWIDTH 0x0000012D
#define IVEFRAGMENTPROGRAM 0x0000012E
#define IVEVERTEXPROGRAM 0x0000012F
#define IVELIGHTMODEL 0x00001121
// Drawables
#define IVEDRAWABLE 0x00001000