From Pavel Moloshton, addition of AlphaFunc support to .ive.
This commit is contained in:
@@ -94,6 +94,10 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AlphaFunc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AnimationPath.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -330,6 +334,10 @@ SOURCE=..\..\..\src\osgPlugins\ive\VisibilityGroup.cpp
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AlphaFunc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\ive\AnimationPath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -766,7 +766,7 @@ void DataSet::DestinationTile::computeMaximumSourceResolution(CompositeSource* s
|
||||
|
||||
SpatialProperties sp = data->computeSpatialProperties(_cs.get());
|
||||
|
||||
if (!sp._extents.intersects(data->getExtents(_cs.get())))
|
||||
if (!sp._extents.intersects(_extents))
|
||||
{
|
||||
std::cout<<"DataSet::DestinationTile::computeMaximumSourceResolution:: source does not overlap ignoring for this tile."<<std::endl;
|
||||
continue;
|
||||
@@ -1581,50 +1581,6 @@ void DataSet::CompositeSource::sort()
|
||||
void DataSet::updateSourcesForDestinationGraphNeeds()
|
||||
{
|
||||
|
||||
std::cout<<"Using source_iterator itr"<<std::endl;
|
||||
for(CompositeSource::source_iterator csitr(_sourceGraph.get());csitr.valid();++csitr)
|
||||
{
|
||||
std::cout<<" Source "<<(*csitr)->getFileName()<<std::endl;
|
||||
}
|
||||
std::cout<<"End of Using Source Iterator itr"<<std::endl;
|
||||
|
||||
std::cout<<"Using Iterator itr"<<std::endl;
|
||||
for(CompositeSource::iterator csitr(_sourceGraph.get());csitr.valid();++csitr)
|
||||
{
|
||||
std::cout<<" Composite Source"<<&(*csitr)<<std::endl;
|
||||
for(CompositeSource::SourceList::iterator itr=csitr->_sourceList.begin();
|
||||
itr!=csitr->_sourceList.end();
|
||||
++itr)
|
||||
{
|
||||
std::cout<<" Source "<<(*itr)->getFileName()<<" res="<<(*itr)->getSortValue()<<std::endl;
|
||||
}
|
||||
csitr->setType(LEVEL_OF_DETAIL);
|
||||
}
|
||||
std::cout<<"End of Source Iterator itr"<<std::endl;
|
||||
|
||||
{
|
||||
for(CompositeSource::source_iterator itr(_sourceGraph.get());itr.valid();++itr)
|
||||
{
|
||||
Source* source = itr->get();
|
||||
source->setSortValueFromSourceDataResolution();
|
||||
std::cout<<"sort "<<source->getFileName()<<" value "<<source->getSortValue()<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
// sort them so highest sortValue is first.
|
||||
|
||||
_sourceGraph->sort();
|
||||
}
|
||||
|
||||
std::cout<<"Using source_lod_iterator itr"<<std::endl;
|
||||
for(CompositeSource::source_lod_iterator csitr(_sourceGraph.get(),CompositeSource::LODSourceAdvancer(0.0));csitr.valid();++csitr)
|
||||
{
|
||||
std::cout<<" LOD "<<(*csitr)->getFileName()<<std::endl;
|
||||
}
|
||||
std::cout<<"End of Using Source Iterator itr"<<std::endl;
|
||||
|
||||
|
||||
|
||||
std::string temporyFilePrefix("temporaryfile_");
|
||||
|
||||
// do standardisation of coordinates systems.
|
||||
|
||||
@@ -107,6 +107,8 @@ class DataSet : public osg::Referenced
|
||||
|
||||
SpatialProperties computeSpatialProperties(osgTerrain::CoordinateSystem* cs) const;
|
||||
|
||||
bool intersects(const SpatialProperties& sp) const;
|
||||
|
||||
void read(DestinationData& destination);
|
||||
|
||||
void readImage(DestinationData& destination);
|
||||
@@ -119,6 +121,7 @@ class DataSet : public osg::Referenced
|
||||
|
||||
osg::ref_ptr<osg::Node> _model;
|
||||
GDALDataset* _gdalDataSet;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
61
src/osgPlugins/ive/AlphaFunc.cpp
Normal file
61
src/osgPlugins/ive/AlphaFunc.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: AlphaFunc.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::AlphaFunc in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Pavlo Moloshtan
|
||||
*
|
||||
* HISTORY: Created 30.11.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "AlphaFunc.h"
|
||||
#include "Object.h"
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void AlphaFunc::write(DataOutputStream* out){
|
||||
|
||||
// write AlphaFunc's identification
|
||||
out->writeInt(IVEALPHAFUNC);
|
||||
|
||||
// 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("AlphaFunc::write(): Could not cast this osg::AlphaFunc to an osg::Object.");
|
||||
|
||||
// write AlphaFunc's properties
|
||||
out->writeInt(getFunction());
|
||||
out->writeFloat(getReferenceValue());
|
||||
}
|
||||
|
||||
void AlphaFunc::read(DataInputStream* in){
|
||||
|
||||
// peek on AlphaFunc's identification
|
||||
int id = in->peekInt();
|
||||
if(id == IVEALPHAFUNC)
|
||||
{
|
||||
// read AlphaFunc'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("AlphaFunc::read(): Could not cast this osg::AlphaFunc to an osg::Object.");
|
||||
|
||||
// Read AlphaFunc's properties
|
||||
osg::AlphaFunc::ComparisonFunction comparison_funtion = osg::AlphaFunc::ComparisonFunction(in->readInt());
|
||||
float reference_value = in->readFloat();
|
||||
setFunction(comparison_funtion, reference_value);
|
||||
}
|
||||
else{
|
||||
throw Exception("AlphaFunc::read(): Expected AlphaFunc identification.");
|
||||
}
|
||||
}
|
||||
15
src/osgPlugins/ive/AlphaFunc.h
Normal file
15
src/osgPlugins/ive/AlphaFunc.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef IVE_ALPHAFUNC
|
||||
#define IVE_ALPHAFUNC 1
|
||||
|
||||
#include <osg/AlphaFunc>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive{
|
||||
class AlphaFunc : public osg::AlphaFunc, public ReadWrite {
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
||||
void read(DataInputStream* in);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "DataInputStream.h"
|
||||
#include "StateSet.h"
|
||||
#include "AlphaFunc.h"
|
||||
#include "BlendFunc.h"
|
||||
#include "Material.h"
|
||||
#include "CullFace.h"
|
||||
@@ -530,7 +531,11 @@ osg::StateAttribute* DataInputStream::readStateAttribute()
|
||||
|
||||
osg::StateAttribute* attribute;
|
||||
int attributeID = peekInt();
|
||||
if(attributeID == IVEBLENDFUNC){
|
||||
if(attributeID == IVEALPHAFUNC){
|
||||
attribute = new osg::AlphaFunc();
|
||||
((ive::AlphaFunc*)(attribute))->read(this);
|
||||
}
|
||||
else if(attributeID == IVEBLENDFUNC){
|
||||
attribute = new osg::BlendFunc();
|
||||
((ive::BlendFunc*)(attribute))->read(this);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "Exception.h"
|
||||
|
||||
#include "StateSet.h"
|
||||
#include "AlphaFunc.h"
|
||||
#include "BlendFunc.h"
|
||||
#include "Material.h"
|
||||
#include "CullFace.h"
|
||||
@@ -403,7 +404,10 @@ void DataOutputStream::writeStateAttribute(const osg::StateAttribute* attribute)
|
||||
writeInt(id);
|
||||
|
||||
// write the stateset.
|
||||
if(dynamic_cast<const osg::BlendFunc*>(attribute)){
|
||||
if(dynamic_cast<const osg::AlphaFunc*>(attribute)){
|
||||
((ive::AlphaFunc*)(attribute))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::BlendFunc*>(attribute)){
|
||||
((ive::BlendFunc*)(attribute))->write(this);
|
||||
}
|
||||
// This is a Material
|
||||
|
||||
@@ -2,6 +2,7 @@ TOPDIR = ../../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
AlphaFunc.cpp\
|
||||
AnimationPath.cpp\
|
||||
AnimationPathCallback.cpp\
|
||||
Billboard.cpp\
|
||||
|
||||
Reference in New Issue
Block a user