From Corbin Holtz, "I have completed my mods to the OpenFlight loader (modified files are
attached): * Light point strings using the REPLICATE opcode should now be supported (>=15.6?) * Directional lights should now work as in Performer using a viewing frustrum defined by a direction vector, horizontal angular width, vertical angular width, and roll angle about the direction vector. The current directional light implementation had some bad assumptions which caused problems with direction vectors not on the XY plane. * IVE and OSG reader/writers were updated as appropriate"
This commit is contained in:
47
src/osgPlugins/ive/DirectionalSector.cpp
Normal file
47
src/osgPlugins/ive/DirectionalSector.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: DirectionalSector.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osgSim::DirectionalSector in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerator.exe
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 9.9.2003
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "DirectionalSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void DirectionalSector::write(DataOutputStream* out){
|
||||
// Write DirectionalSector's identification.
|
||||
out->writeInt(IVEDIRECTIONALSECTOR);
|
||||
// Write DirectionalSector's properties.
|
||||
out->writeVec3(getDirection());
|
||||
out->writeFloat(getHorizLobeAngle());
|
||||
out->writeFloat(getVertLobeAngle());
|
||||
out->writeFloat(getLobeRollAngle());
|
||||
out->writeFloat(getFadeAngle());
|
||||
}
|
||||
|
||||
void DirectionalSector::read(DataInputStream* in){
|
||||
// Peek on DirectionalSector's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDIRECTIONALSECTOR){
|
||||
// Read DirectionalSector's identification.
|
||||
id = in->readInt();
|
||||
// Read DirectionalSector's properties
|
||||
setDirection(in->readVec3());
|
||||
setHorizLobeAngle(in->readFloat());
|
||||
setVertLobeAngle(in->readFloat());
|
||||
setLobeRollAngle(in->readFloat());
|
||||
setFadeAngle(in->readFloat());
|
||||
|
||||
}
|
||||
else{
|
||||
throw Exception("DirectionalSector::read(): Expected DirectionalSector identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/DirectionalSector.h
Normal file
15
src/osgPlugins/ive/DirectionalSector.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_DIRECTIONALSECTOR
|
||||
#define IVE_DIRECTIONALSECTOR 1
|
||||
|
||||
#include <osgSim/Sector>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class DirectionalSector : public osgSim::DirectionalSector, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -65,6 +65,7 @@ CXXFILES =\
|
||||
AzimSector.cpp\
|
||||
BlinkSequence.cpp\
|
||||
ConeSector.cpp\
|
||||
DirectionalSector.cpp\
|
||||
ElevationSector.cpp\
|
||||
LightPoint.cpp\
|
||||
LightPointNode.cpp\
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "ElevationSector.h"
|
||||
#include "AzimSector.h"
|
||||
#include "ConeSector.h"
|
||||
#include "DirectionalSector.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
@@ -47,6 +48,9 @@ void LightPoint::write(DataOutputStream* out){
|
||||
else if(dynamic_cast<osgSim::ConeSector*>(_sector.get())){
|
||||
((ive::ConeSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else if(dynamic_cast<osgSim::DirectionalSector*>(_sector.get())){
|
||||
((ive::DirectionalSector*)(_sector.get()))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown sector in LightPoint::write()");
|
||||
}
|
||||
@@ -99,6 +103,11 @@ void LightPoint::read(DataInputStream* in){
|
||||
((ive::ConeSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else if(attributeID == IVEDIRECTIONALSECTOR){
|
||||
sector = new osgSim::DirectionalSector();
|
||||
((ive::DirectionalSector*)(sector))->read(in);
|
||||
_sector = sector;
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown sector in LightPoint::read()");
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace ive {
|
||||
#define IVEMULTISWITCH 0x00100008
|
||||
|
||||
#define IVEVISIBILITYGROUP 0x00100009
|
||||
#define IVEDIRECTIONALSECTOR 0x0010000A
|
||||
|
||||
class ReadWrite{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user