Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e60af7cc0 | ||
|
|
a7519c9e95 | ||
|
|
3ba312116b | ||
|
|
e6ab3ddb7d | ||
|
|
8ed0fec364 | ||
|
|
ddfdbd75b8 | ||
|
|
00e21af5bb | ||
|
|
51a17a7a0f | ||
|
|
fa58672f09 | ||
|
|
4f7f5023df | ||
|
|
4838a9690e | ||
|
|
edcbfb52eb | ||
|
|
5af8bb7c8e |
@@ -1,5 +1,4 @@
|
|||||||
Makefile
|
Makefile
|
||||||
SimGear.spec
|
|
||||||
*.o
|
*.o
|
||||||
lib*.a
|
lib*.a
|
||||||
.*.swp
|
.*.swp
|
||||||
|
|||||||
+3
-3
@@ -110,9 +110,6 @@ endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
|||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
|
||||||
find_package(Threads REQUIRED)
|
|
||||||
|
|
||||||
if(SIMGEAR_HEADLESS)
|
if(SIMGEAR_HEADLESS)
|
||||||
message(STATUS "SimGear mode: HEADLESS")
|
message(STATUS "SimGear mode: HEADLESS")
|
||||||
else()
|
else()
|
||||||
@@ -148,6 +145,9 @@ else()
|
|||||||
message(STATUS "Subversion client support: DISABLED")
|
message(STATUS "Subversion client support: DISABLED")
|
||||||
endif(ENABLE_LIBSVN)
|
endif(ENABLE_LIBSVN)
|
||||||
|
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||||
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
|
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
|
||||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||||
|
|||||||
@@ -16,14 +16,18 @@ macro(find_static_component comp libs)
|
|||||||
string(TOUPPER "${comp}" compLibBase)
|
string(TOUPPER "${comp}" compLibBase)
|
||||||
set( compLibName ${compLibBase}_LIBRARY )
|
set( compLibName ${compLibBase}_LIBRARY )
|
||||||
|
|
||||||
|
# NO_DEFAULT_PATH is important on Mac - we need to ensure subversion
|
||||||
|
# libraires in dist/ or Macports are picked over the Apple version
|
||||||
|
# in /usr, since that's what we will ship.
|
||||||
FIND_LIBRARY(${compLibName}
|
FIND_LIBRARY(${compLibName}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
NAMES ${compLib}
|
NAMES ${compLib}
|
||||||
HINTS $ENV{PLIBDIR}
|
HINTS $ENV{LIBSVN_DIR} ${CMAKE_INSTALL_PREFIX}
|
||||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
PATHS
|
PATHS
|
||||||
|
/opt/local
|
||||||
/usr/local
|
/usr/local
|
||||||
/usr
|
/usr
|
||||||
/opt
|
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND ${libs} ${${compLibName}})
|
list(APPEND ${libs} ${${compLibName}})
|
||||||
@@ -49,13 +53,14 @@ endif(HAVE_APR_CONFIG)
|
|||||||
|
|
||||||
if(HAVE_APR_CONFIG OR MSVC)
|
if(HAVE_APR_CONFIG OR MSVC)
|
||||||
find_path(LIBSVN_INCLUDE_DIR svn_client.h
|
find_path(LIBSVN_INCLUDE_DIR svn_client.h
|
||||||
|
NO_DEFAULT_PATH
|
||||||
HINTS
|
HINTS
|
||||||
$ENV{LIBSVN_DIR}
|
$ENV{LIBSVN_DIR} ${CMAKE_INSTALL_PREFIX}
|
||||||
PATH_SUFFIXES include/subversion-1
|
PATH_SUFFIXES include/subversion-1
|
||||||
PATHS
|
PATHS
|
||||||
|
/opt/local
|
||||||
/usr/local
|
/usr/local
|
||||||
/usr
|
/usr
|
||||||
/opt
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LIBSVN_LIBRARIES "")
|
set(LIBSVN_LIBRARIES "")
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Building a SimGear RPM package for Red Hat
|
||||||
|
|
||||||
|
Please see the "package/openSUSE" directory for an
|
||||||
|
example how to build a SimGear RPM package with
|
||||||
|
shared SimGear libraries.
|
||||||
|
|
||||||
|
You may need to adapt the names (exact spelling) of some
|
||||||
|
of the package dependencies in the openSUSE RPM spec,
|
||||||
|
since these may slightly differ for Red Hat.
|
||||||
|
|
||||||
|
(If you have a working and tested Red Hat RPM spec,
|
||||||
|
you're welcome to contribute it to this project.)
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
Building a SimGear RPM package for openSUSE
|
||||||
|
|
||||||
|
(Last tested with openSUSE 11.4+12.1)
|
||||||
|
|
||||||
|
This directory contains the files which, along with
|
||||||
|
the source code tar files, can be used to build
|
||||||
|
an RPM package targeted at an openSUSE Linux system.
|
||||||
|
|
||||||
|
To build SimGear from source do the following:
|
||||||
|
|
||||||
|
1. obtain simgear-2.8.0.tar.bz2 (adapt version if
|
||||||
|
necessary) and copy it into ~/rpmbuild/SOURCES
|
||||||
|
|
||||||
|
2. look in the BuildRequires section of SimGear.spec
|
||||||
|
and check that all the packages referred to are
|
||||||
|
installed (note, some of these packages may be part
|
||||||
|
of openSUSE's "games" repository).
|
||||||
|
|
||||||
|
3. run 'rpmbuild -ba simgear.spec' and find the RPM
|
||||||
|
build result in ~/rpmbuild/RPMS
|
||||||
|
|
||||||
|
That's all!
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
Summary: Simulator Construction Gear
|
||||||
|
Name: SimGear
|
||||||
|
Version: 2.8.0
|
||||||
|
Release: 1
|
||||||
|
License: LGPL
|
||||||
|
URL: http://www.flightgear.org
|
||||||
|
Group: Amusements/Games/3D/Simulation
|
||||||
|
Source: http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/Source/simgear-%{version}.tar.bz2
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
|
BuildRequires: gcc, gcc-c++, cmake
|
||||||
|
BuildRequires: freealut, freealut-devel
|
||||||
|
BuildRequires: libopenal1-soft, openal-soft
|
||||||
|
BuildRequires: plib-devel >= 1.8.5
|
||||||
|
BuildRequires: libOpenSceneGraph-devel >= 3.0
|
||||||
|
BuildRequires: zlib, zlib-devel
|
||||||
|
BuildRequires: libjpeg62, libjpeg62-devel
|
||||||
|
BuildRequires: boost-devel >= 1.37
|
||||||
|
BuildRequires: subversion-devel, libapr1-devel
|
||||||
|
Requires: OpenSceneGraph-plugins >= 3.0
|
||||||
|
|
||||||
|
%description
|
||||||
|
This package contains a tools and libraries useful for constructing
|
||||||
|
simulation and visualization applications such as FlightGear or TerraGear.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Group: Development/Libraries/Other
|
||||||
|
Summary: Development header files for SimGear
|
||||||
|
Requires: SimGear = %{version}
|
||||||
|
Requires: plib-devel
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Development headers and libraries for building applications against SimGear.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -T -q -n simgear-%{version} -b 0
|
||||||
|
|
||||||
|
%build
|
||||||
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
export CXXFLAGS="$RPM_OPT_FLAGS"
|
||||||
|
# build SHARED simgear libraries
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DSIMGEAR_SHARED:BOOL=ON -DENABLE_TESTS:BOOL=OFF -DJPEG_FACTORY:BOOL=ON
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
make DESTDIR=%{buildroot} install
|
||||||
|
|
||||||
|
%post -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-, root, root, -)
|
||||||
|
%doc AUTHORS COPYING ChangeLog NEWS README
|
||||||
|
%{_libdir}/libSimGear*.so.*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%dir %{_includedir}/simgear
|
||||||
|
%{_includedir}/simgear/*
|
||||||
|
%{_libdir}/libSimGear*.so
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Jul 02 2012 thorstenb@flightgear.org
|
||||||
|
- Initial version
|
||||||
|
|
||||||
@@ -59,12 +59,7 @@ if(SIMGEAR_SHARED)
|
|||||||
|
|
||||||
if(LIBSVN_FOUND)
|
if(LIBSVN_FOUND)
|
||||||
add_definitions(${APR_CFLAGS})
|
add_definitions(${APR_CFLAGS})
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
set_property(SOURCE scene/tsync/terrasync.cxx PROPERTY COMPILE_FLAGS "-iwithsysroot ${LIBSVN_INCLUDE_DIR}")
|
|
||||||
ELSE()
|
|
||||||
include_directories(${LIBSVN_INCLUDE_DIR})
|
include_directories(${LIBSVN_INCLUDE_DIR})
|
||||||
ENDIF(APPLE)
|
|
||||||
target_link_libraries(SimGearCore ${LIBSVN_LIBRARIES})
|
target_link_libraries(SimGearCore ${LIBSVN_LIBRARIES})
|
||||||
endif(LIBSVN_FOUND)
|
endif(LIBSVN_FOUND)
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
#include <osg/ClipNode>
|
#include <osg/ClipNode>
|
||||||
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SGPrecipitation constructor
|
* @brief SGPrecipitation constructor
|
||||||
@@ -79,6 +80,8 @@ osg::Group* SGPrecipitation::build(void)
|
|||||||
group->addChild(_precipitationEffect.get());
|
group->addChild(_precipitationEffect.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group->setNodeMask( ~(simgear::CASTSHADOW_BIT | simgear::MODELLIGHT_BIT) );
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
if (_elements.size() < num_components)
|
if (_elements.size() < num_components)
|
||||||
throw sg_exception();
|
throw sg_exception();
|
||||||
for (int i = 0; i < num_components; ++i)
|
for (int i = 0; i < num_components; ++i)
|
||||||
result[i] = _elements[i]->getValue<double>();
|
result[i] = _elements[i]->template getValue<double>();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
void set(const T& val)
|
void set(const T& val)
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
// conversion operators
|
// conversion operators
|
||||||
operator T () const
|
operator T () const
|
||||||
{
|
{
|
||||||
return getOrThrow()->getValue<T>();
|
return getOrThrow()->template getValue<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
T operator=(const T& aValue)
|
T operator=(const T& aValue)
|
||||||
|
|||||||
@@ -797,9 +797,11 @@ SGPropertyNode::alias (SGPropertyNode * target)
|
|||||||
else
|
else
|
||||||
if (_type == props::ALIAS)
|
if (_type == props::ALIAS)
|
||||||
{
|
{
|
||||||
|
if (_value.alias == target)
|
||||||
|
return true; // ok, identical alias requested
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
"Failed to create alias at " << target->getPath() << ". "
|
"Failed to create alias at " << target->getPath() << ". "
|
||||||
"Source "<< getPath() << " is also an alias. Unsupported recursion.");
|
"Source "<< getPath() << " is already aliasing another property.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (_tied)
|
if (_tied)
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ void findAttr(const effect::EffectPropertyMap<T>& pMap,
|
|||||||
{
|
{
|
||||||
using namespace effect;
|
using namespace effect;
|
||||||
typename EffectPropertyMap<T>::BMap::iterator itr
|
typename EffectPropertyMap<T>::BMap::iterator itr
|
||||||
= pMap._map.get<from>().find(name);
|
= pMap._map.template get<from>().find(name);
|
||||||
if (itr == pMap._map.end()) {
|
if (itr == pMap._map.end()) {
|
||||||
throw effect::BuilderException(string("findAttr: could not find attribute ")
|
throw effect::BuilderException(string("findAttr: could not find attribute ")
|
||||||
+ string(name));
|
+ string(name));
|
||||||
@@ -233,7 +233,7 @@ const T* findAttr(const effect::EffectPropertyMap<T>& pMap,
|
|||||||
{
|
{
|
||||||
using namespace effect;
|
using namespace effect;
|
||||||
typename EffectPropertyMap<T>::BMap::iterator itr
|
typename EffectPropertyMap<T>::BMap::iterator itr
|
||||||
= pMap._map.get<from>().find(name);
|
= pMap._map.template get<from>().find(name);
|
||||||
if (itr == pMap._map.end())
|
if (itr == pMap._map.end())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
@@ -267,8 +267,8 @@ std::string findName(const effect::EffectPropertyMap<T>& pMap, T value)
|
|||||||
using namespace effect;
|
using namespace effect;
|
||||||
std::string result;
|
std::string result;
|
||||||
typename EffectPropertyMap<T>::BMap::template index_iterator<to>::type itr
|
typename EffectPropertyMap<T>::BMap::template index_iterator<to>::type itr
|
||||||
= pMap._map.get<to>().find(value);
|
= pMap._map.template get<to>().find(value);
|
||||||
if (itr != pMap._map.get<to>().end())
|
if (itr != pMap._map.template get<to>().end())
|
||||||
result = itr->first;
|
result = itr->first;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
if (fullTexPath.empty()) {
|
if (fullTexPath.empty()) {
|
||||||
tpath = SGPath("Textures");
|
tpath.set("Textures");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
if (fullTexPath.empty()) {
|
if (fullTexPath.empty()) {
|
||||||
@@ -173,7 +173,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
if (fullTexPath.empty()) {
|
if (fullTexPath.empty()) {
|
||||||
tpath = SGPath("Textures");
|
tpath.set("Textures");
|
||||||
tpath.append(tname);
|
tpath.append(tname);
|
||||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||||
if (fullTexPath.empty() ) {
|
if (fullTexPath.empty() ) {
|
||||||
@@ -217,7 +217,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
string fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
string fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
||||||
|
|
||||||
if (fullMaskPath.empty()) {
|
if (fullMaskPath.empty()) {
|
||||||
ompath = SGPath("Textures");
|
ompath.set("Textures");
|
||||||
ompath.append(omname);
|
ompath.append(omname);
|
||||||
fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
||||||
}
|
}
|
||||||
@@ -238,8 +238,11 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
if (dds[i] != dds_mask) {
|
if (dds[i] != dds_mask) {
|
||||||
// Texture format does not match mask format. This is relevant for
|
// Texture format does not match mask format. This is relevant for
|
||||||
// the object mask, as DDS textures have an origin at the bottom
|
// the object mask, as DDS textures have an origin at the bottom
|
||||||
// left rather than top left, therefore we flip the object mask
|
// left rather than top left. Therefore we flip a copy of the image
|
||||||
// vertically.
|
// (otherwise a second reference to the object mask would flip it
|
||||||
|
// back!).
|
||||||
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Flipping object mask" << omname);
|
||||||
|
image = (osg::Image* ) image->clone(osg::CopyOp::SHALLOW_COPY);
|
||||||
image->flipVertical();
|
image->flipVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +335,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||||
|
|
||||||
if (tree_texture.empty()) {
|
if (tree_texture.empty()) {
|
||||||
treePath = SGPath("Textures");
|
treePath.set("Textures");
|
||||||
treePath.append(treeTexPath);
|
treePath.append(treeTexPath);
|
||||||
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,7 +378,6 @@ SGAnimation::SGAnimation(const SGPropertyNode* configNode,
|
|||||||
{
|
{
|
||||||
_name = configNode->getStringValue("name", "");
|
_name = configNode->getStringValue("name", "");
|
||||||
_enableHOT = configNode->getBoolValue("enable-hot", true);
|
_enableHOT = configNode->getBoolValue("enable-hot", true);
|
||||||
_disableShadow = configNode->getBoolValue("disable-shadow", false);
|
|
||||||
std::vector<SGPropertyNode_ptr> objectNames =
|
std::vector<SGPropertyNode_ptr> objectNames =
|
||||||
configNode->getChildren("object-name");
|
configNode->getChildren("object-name");
|
||||||
for (unsigned i = 0; i < objectNames.size(); ++i)
|
for (unsigned i = 0; i < objectNames.size(); ++i)
|
||||||
@@ -501,10 +500,6 @@ SGAnimation::install(osg::Node& node)
|
|||||||
node.setNodeMask( SG_NODEMASK_TERRAIN_BIT | node.getNodeMask());
|
node.setNodeMask( SG_NODEMASK_TERRAIN_BIT | node.getNodeMask());
|
||||||
else
|
else
|
||||||
node.setNodeMask(~SG_NODEMASK_TERRAIN_BIT & node.getNodeMask());
|
node.setNodeMask(~SG_NODEMASK_TERRAIN_BIT & node.getNodeMask());
|
||||||
if (!_disableShadow)
|
|
||||||
node.setNodeMask( SG_NODEMASK_CASTSHADOW_BIT | node.getNodeMask());
|
|
||||||
else
|
|
||||||
node.setNodeMask(~SG_NODEMASK_CASTSHADOW_BIT & node.getNodeMask());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Group*
|
osg::Group*
|
||||||
@@ -1825,12 +1820,13 @@ osg::Group*
|
|||||||
SGShadowAnimation::createAnimationGroup(osg::Group& parent)
|
SGShadowAnimation::createAnimationGroup(osg::Group& parent)
|
||||||
{
|
{
|
||||||
SGSharedPtr<SGCondition const> condition = getCondition();
|
SGSharedPtr<SGCondition const> condition = getCondition();
|
||||||
if (!condition)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
osg::Group* group = new osg::Group;
|
osg::Group* group = new osg::Group;
|
||||||
group->setName("shadow animation");
|
group->setName("shadow animation");
|
||||||
|
if (condition)
|
||||||
group->setUpdateCallback(new UpdateCallback(condition));
|
group->setUpdateCallback(new UpdateCallback(condition));
|
||||||
|
else
|
||||||
|
group->setNodeMask(~SG_NODEMASK_CASTSHADOW_BIT & group->getNodeMask());
|
||||||
parent.addChild(group);
|
parent.addChild(group);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ private:
|
|||||||
std::list<std::string> _objectNames;
|
std::list<std::string> _objectNames;
|
||||||
std::list<osg::ref_ptr<osg::Node> > _installedAnimations;
|
std::list<osg::ref_ptr<osg::Node> > _installedAnimations;
|
||||||
bool _enableHOT;
|
bool _enableHOT;
|
||||||
bool _disableShadow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ osg::Group* Particles::getCommonRoot()
|
|||||||
commonGeode.get()->setName("common particle system geode");
|
commonGeode.get()->setName("common particle system geode");
|
||||||
commonRoot.get()->addChild(commonGeode.get());
|
commonRoot.get()->addChild(commonGeode.get());
|
||||||
commonRoot.get()->addChild(psu.get());
|
commonRoot.get()->addChild(psu.get());
|
||||||
|
commonRoot->setNodeMask( ~simgear::MODELLIGHT_BIT );
|
||||||
}
|
}
|
||||||
return commonRoot.get();
|
return commonRoot.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,9 +167,10 @@ void CloudShaderGeometry::generateGeometry()
|
|||||||
|
|
||||||
// Create front and back polygons so we don't need to screw around
|
// Create front and back polygons so we don't need to screw around
|
||||||
// with two-sided lighting in the shader.
|
// with two-sided lighting in the shader.
|
||||||
osg::Vec3Array& v = *(new osg::Vec3Array(4 * numsprites));
|
osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;
|
||||||
osg::Vec4Array& c = *(new osg::Vec4Array(4 * numsprites));
|
osg::ref_ptr<osg::Vec3Array> n = new osg::Vec3Array;
|
||||||
osg::Vec2Array& t = *(new osg::Vec2Array(4 * numsprites));
|
osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;
|
||||||
|
osg::ref_ptr<osg::Vec2Array> t = new osg::Vec2Array;
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
@@ -182,10 +183,19 @@ void CloudShaderGeometry::generateGeometry()
|
|||||||
float ch = 0.5f * iter->height;
|
float ch = 0.5f * iter->height;
|
||||||
|
|
||||||
// Create the vertices
|
// Create the vertices
|
||||||
v[4*idx ].set(0.0f, -cw, -ch);
|
v->push_back(osg::Vec3(0.0f, -cw, -ch));
|
||||||
v[4*idx+1].set(0.0f, cw, -ch);
|
v->push_back(osg::Vec3(0.0f, cw, -ch));
|
||||||
v[4*idx+2].set(0.0f, cw, ch);
|
v->push_back(osg::Vec3(0.0f, cw, ch));
|
||||||
v[4*idx+3].set(0.0f, -cw, ch);
|
v->push_back(osg::Vec3(0.0f, -cw, ch));
|
||||||
|
|
||||||
|
// The normals aren't actually used in lighting,
|
||||||
|
// but we set them per vertex as this is more
|
||||||
|
// efficient than an overall binding on some
|
||||||
|
// graphics cards.
|
||||||
|
n->push_back(osg::Vec3(1.0f, -1.0f, -1.0f));
|
||||||
|
n->push_back(osg::Vec3(1.0f, 1.0f, -1.0f));
|
||||||
|
n->push_back(osg::Vec3(1.0f, 1.0f, 1.0f));
|
||||||
|
n->push_back(osg::Vec3(1.0f, -1.0f, 1.0f));
|
||||||
|
|
||||||
// Set the texture coords for each vertex
|
// Set the texture coords for each vertex
|
||||||
// from the texture index, and the number
|
// from the texture index, and the number
|
||||||
@@ -193,35 +203,27 @@ void CloudShaderGeometry::generateGeometry()
|
|||||||
int x = iter->texture_index_x;
|
int x = iter->texture_index_x;
|
||||||
int y = iter->texture_index_y;
|
int y = iter->texture_index_y;
|
||||||
|
|
||||||
t[4*idx ].set( (float) x / varieties_x, (float) y / varieties_y);
|
t->push_back(osg::Vec2( (float) x / varieties_x, (float) y / varieties_y));
|
||||||
t[4*idx+1].set( (float) (x + 1) / varieties_x, (float) y / varieties_y);
|
t->push_back(osg::Vec2( (float) (x + 1) / varieties_x, (float) y / varieties_y));
|
||||||
t[4*idx+2].set( (float) (x + 1) / varieties_x, (float) (y + 1) / varieties_y);
|
t->push_back(osg::Vec2( (float) (x + 1) / varieties_x, (float) (y + 1) / varieties_y));
|
||||||
t[4*idx+3].set( (float) x / varieties_x, (float) (y + 1) / varieties_y);
|
t->push_back(osg::Vec2( (float) x / varieties_x, (float) (y + 1) / varieties_y));
|
||||||
|
|
||||||
// The color isn't actually use in lighting, but instead to indicate the center of rotation
|
// The color isn't actually use in lighting, but instead to indicate the center of rotation
|
||||||
c[4*idx ].set(iter->position.x(), iter->position.y(), iter->position.z(), zscale);
|
c->push_back(osg::Vec4(iter->position.x(), iter->position.y(), iter->position.z(), zscale));
|
||||||
c[4*idx+1].set(iter->position.x(), iter->position.y(), iter->position.z(), zscale);
|
c->push_back(osg::Vec4(iter->position.x(), iter->position.y(), iter->position.z(), zscale));
|
||||||
c[4*idx+2].set(iter->position.x(), iter->position.y(), iter->position.z(), zscale);
|
c->push_back(osg::Vec4(iter->position.x(), iter->position.y(), iter->position.z(), zscale));
|
||||||
c[4*idx+3].set(iter->position.x(), iter->position.y(), iter->position.z(), zscale);
|
c->push_back(osg::Vec4(iter->position.x(), iter->position.y(), iter->position.z(), zscale));
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Quads now created, add it to the geometry.
|
//Quads now created, add it to the geometry.
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::Geometry* geom = new osg::Geometry;
|
||||||
geom->setVertexArray(&v);
|
geom->setVertexArray(v);
|
||||||
geom->setTexCoordArray(0, &t);
|
geom->setTexCoordArray(0, t);
|
||||||
|
geom->setNormalArray(n);
|
||||||
// The normal isn't actually use in lighting, so we simply bind overall.
|
geom->setNormalBinding(Geometry::BIND_PER_VERTEX);
|
||||||
osg::Vec3Array& n = *(new osg::Vec3Array(4));
|
geom->setColorArray(c);
|
||||||
n[0].set(1.0f, -1.0f, -1.0f);
|
|
||||||
n[1].set(1.0f, 1.0f, -1.0f);
|
|
||||||
n[2].set(1.0f, 1.0f, 1.0f);
|
|
||||||
n[3].set(1.0f, -1.0f, 1.0f);
|
|
||||||
|
|
||||||
geom->setNormalArray(&n);
|
|
||||||
geom->setNormalBinding(Geometry::BIND_OVERALL);
|
|
||||||
geom->setColorArray(&c);
|
|
||||||
geom->setColorBinding(Geometry::BIND_PER_VERTEX);
|
geom->setColorBinding(Geometry::BIND_PER_VERTEX);
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numsprites*4));
|
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numsprites*4));
|
||||||
_geometry = geom;
|
_geometry = geom;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||||
#include <simgear/scene/util/StateAttributeFactory.hxx>
|
#include <simgear/scene/util/StateAttributeFactory.hxx>
|
||||||
#include <simgear/scene/util/SGUpdateVisitor.hxx>
|
#include <simgear/scene/util/SGUpdateVisitor.hxx>
|
||||||
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <osg/BlendFunc>
|
#include <osg/BlendFunc>
|
||||||
@@ -248,6 +249,7 @@ osg::ref_ptr<EffectGeode> SGNewCloud::genCloud() {
|
|||||||
geode->addDrawable(sg);
|
geode->addDrawable(sg);
|
||||||
geode->setName("3D cloud");
|
geode->setName("3D cloud");
|
||||||
geode->setEffect(effect.get());
|
geode->setEffect(effect.get());
|
||||||
|
geode->setNodeMask( ~simgear::MODELLIGHT_BIT );
|
||||||
|
|
||||||
return geode;
|
return geode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,10 +79,10 @@ void addBuildingToLeafGeode(Geode* geode, const SGBuildingBin::Building& buildin
|
|||||||
|
|
||||||
// Get or create geometry.
|
// Get or create geometry.
|
||||||
osg::ref_ptr<osg::Geometry> geom;
|
osg::ref_ptr<osg::Geometry> geom;
|
||||||
osg::Vec3Array* v = new osg::Vec3Array;
|
osg::ref_ptr<osg::Vec3Array> v;
|
||||||
osg::Vec2Array* t = new osg::Vec2Array;
|
osg::ref_ptr<osg::Vec2Array> t;
|
||||||
osg::Vec4Array* c = new osg::Vec4Array; // single value
|
osg::ref_ptr<osg::Vec4Array> c;
|
||||||
osg::Vec3Array* n = new osg::Vec3Array;
|
osg::ref_ptr<osg::Vec3Array> n;
|
||||||
|
|
||||||
if (geode->getNumDrawables() == 0) {
|
if (geode->getNumDrawables() == 0) {
|
||||||
geom = new osg::Geometry;
|
geom = new osg::Geometry;
|
||||||
@@ -619,8 +619,8 @@ osg::Group* createRandomBuildings(SGBuildingBinList buildings, const osg::Matrix
|
|||||||
params->getChild("texture", 0, true)->getChild("image", 0, true)
|
params->getChild("texture", 0, true)->getChild("image", 0, true)
|
||||||
->setStringValue(bin->texture);
|
->setStringValue(bin->texture);
|
||||||
|
|
||||||
// Light map - n=1
|
// Light map - n=3
|
||||||
params->getChild("texture", 1, true)->getChild("image", 0, true)
|
params->getChild("texture", 3, true)->getChild("image", 0, true)
|
||||||
->setStringValue(bin->lightMap);
|
->setStringValue(bin->lightMap);
|
||||||
|
|
||||||
effect = makeEffect(effectProp, true, options);
|
effect = makeEffect(effectProp, true, options);
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ struct SGTileGeometryBin {
|
|||||||
// Set the next location to place a building
|
// Set the next location to place a building
|
||||||
a += stepv0;
|
a += stepv0;
|
||||||
|
|
||||||
if ( a + b > 1.0f ) {
|
if ((a + b) > 1.0f) {
|
||||||
// Reached the end of the scan-line on v0. Reset and increment
|
// Reached the end of the scan-line on v0. Reset and increment
|
||||||
// scan-line on v1
|
// scan-line on v1
|
||||||
a = mt_rand(&seed) * stepv0;
|
a = mt_rand(&seed) * stepv0;
|
||||||
@@ -567,8 +567,15 @@ struct SGTileGeometryBin {
|
|||||||
|
|
||||||
if (b > 1.0f) {
|
if (b > 1.0f) {
|
||||||
// In a degenerate case of a single point, we might be outside the
|
// In a degenerate case of a single point, we might be outside the
|
||||||
// scanline.
|
// scanline. Note that we need to still ensure that a+b < 1.
|
||||||
b = mt_rand(&seed) * stepv1;
|
b = mt_rand(&seed) * stepv1 * (1.0f - a);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((a + b) > 1.0f ) {
|
||||||
|
// Truly degenerate case - simply choose a random point guaranteed
|
||||||
|
// to fulfil the constraing of a+b < 1.
|
||||||
|
a = mt_rand(&seed);
|
||||||
|
b = mt_rand(&seed) * (1.0f - a);
|
||||||
}
|
}
|
||||||
|
|
||||||
SGVec3f randomPoint = vorigin + a*v0 + b*v1;
|
SGVec3f randomPoint = vorigin + a*v0 + b*v1;
|
||||||
@@ -1153,7 +1160,7 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
|
|||||||
osg::LOD* lightLOD = new osg::LOD;
|
osg::LOD* lightLOD = new osg::LOD;
|
||||||
lightLOD->addChild(lightGroup.get(), 0, 30000);
|
lightLOD->addChild(lightGroup.get(), 0, 30000);
|
||||||
// VASI is always on, so doesn't use light bits.
|
// VASI is always on, so doesn't use light bits.
|
||||||
lightLOD->setNodeMask(LIGHTS_BITS | MODEL_BIT);
|
lightLOD->setNodeMask(LIGHTS_BITS | MODEL_BIT | PERMANENTLIGHT_BIT);
|
||||||
transform->addChild(lightLOD);
|
transform->addChild(lightLOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,7 @@ set(SOURCES
|
|||||||
|
|
||||||
if(LIBSVN_FOUND)
|
if(LIBSVN_FOUND)
|
||||||
add_definitions(${APR_CFLAGS})
|
add_definitions(${APR_CFLAGS})
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
set_property(SOURCE terrasync.cxx PROPERTY COMPILE_FLAGS "-iwithsysroot ${LIBSVN_INCLUDE_DIR}")
|
|
||||||
ELSE()
|
|
||||||
include_directories(${LIBSVN_INCLUDE_DIR})
|
include_directories(${LIBSVN_INCLUDE_DIR})
|
||||||
ENDIF(APPLE)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
|
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ enum NodeMask {
|
|||||||
// Everything else that isn't terrain. Initially for clouds;
|
// Everything else that isn't terrain. Initially for clouds;
|
||||||
// eventually for other models?
|
// eventually for other models?
|
||||||
MODEL_BIT = (1 << 12),
|
MODEL_BIT = (1 << 12),
|
||||||
MODELLIGHT_BIT = (1 << 13)
|
MODELLIGHT_BIT = (1 << 13),
|
||||||
|
PERMANENTLIGHT_BIT = (1 << 14)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Theory of bin numbering:
|
// Theory of bin numbering:
|
||||||
|
|||||||
Reference in New Issue
Block a user