Compare commits
12 Commits
version/2.
...
version/2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56e9158dee | ||
|
|
3ba312116b | ||
|
|
e6ab3ddb7d | ||
|
|
8ed0fec364 | ||
|
|
ddfdbd75b8 | ||
|
|
00e21af5bb | ||
|
|
51a17a7a0f | ||
|
|
fa58672f09 | ||
|
|
4f7f5023df | ||
|
|
4838a9690e | ||
|
|
edcbfb52eb | ||
|
|
5af8bb7c8e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
Makefile
|
||||
SimGear.spec
|
||||
*.o
|
||||
lib*.a
|
||||
.*.swp
|
||||
|
||||
13
package/RedHat/README
Normal file
13
package/RedHat/README
Normal file
@@ -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.)
|
||||
|
||||
23
package/openSUSE/README
Normal file
23
package/openSUSE/README
Normal file
@@ -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!
|
||||
|
||||
66
package/openSUSE/SimGear.spec
Normal file
66
package/openSUSE/SimGear.spec
Normal file
@@ -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
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <simgear/constants.h>
|
||||
#include <osg/ClipNode>
|
||||
#include <simgear/scene/util/RenderConstants.hxx>
|
||||
|
||||
/**
|
||||
* @brief SGPrecipitation constructor
|
||||
@@ -79,6 +80,8 @@ osg::Group* SGPrecipitation::build(void)
|
||||
group->addChild(_precipitationEffect.get());
|
||||
}
|
||||
|
||||
group->setNodeMask( ~(simgear::CASTSHADOW_BIT | simgear::MODELLIGHT_BIT) );
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
@@ -797,9 +797,11 @@ SGPropertyNode::alias (SGPropertyNode * target)
|
||||
else
|
||||
if (_type == props::ALIAS)
|
||||
{
|
||||
if (_value.alias == target)
|
||||
return true; // ok, identical alias requested
|
||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||
"Failed to create alias at " << target->getPath() << ". "
|
||||
"Source "<< getPath() << " is also an alias. Unsupported recursion.");
|
||||
"Source "<< getPath() << " is already aliasing another property.");
|
||||
}
|
||||
else
|
||||
if (_tied)
|
||||
|
||||
@@ -136,7 +136,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
tpath.append(tname);
|
||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty()) {
|
||||
tpath = SGPath("Textures");
|
||||
tpath.set("Textures");
|
||||
tpath.append(tname);
|
||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty()) {
|
||||
@@ -173,7 +173,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
tpath.append(tname);
|
||||
string fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty()) {
|
||||
tpath = SGPath("Textures");
|
||||
tpath.set("Textures");
|
||||
tpath.append(tname);
|
||||
fullTexPath = SGModelLib::findDataFile(tpath.str(), options);
|
||||
if (fullTexPath.empty() ) {
|
||||
@@ -217,7 +217,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
string fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
||||
|
||||
if (fullMaskPath.empty()) {
|
||||
ompath = SGPath("Textures");
|
||||
ompath.set("Textures");
|
||||
ompath.append(omname);
|
||||
fullMaskPath = SGModelLib::findDataFile(ompath.str(), options);
|
||||
}
|
||||
@@ -238,8 +238,11 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
if (dds[i] != dds_mask) {
|
||||
// Texture format does not match mask format. This is relevant for
|
||||
// the object mask, as DDS textures have an origin at the bottom
|
||||
// left rather than top left, therefore we flip the object mask
|
||||
// vertically.
|
||||
// left rather than top left. Therefore we flip a copy of the image
|
||||
// (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();
|
||||
}
|
||||
|
||||
@@ -332,7 +335,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||
|
||||
if (tree_texture.empty()) {
|
||||
treePath = SGPath("Textures");
|
||||
treePath.set("Textures");
|
||||
treePath.append(treeTexPath);
|
||||
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||
}
|
||||
|
||||
@@ -378,7 +378,6 @@ SGAnimation::SGAnimation(const SGPropertyNode* configNode,
|
||||
{
|
||||
_name = configNode->getStringValue("name", "");
|
||||
_enableHOT = configNode->getBoolValue("enable-hot", true);
|
||||
_disableShadow = configNode->getBoolValue("disable-shadow", false);
|
||||
std::vector<SGPropertyNode_ptr> objectNames =
|
||||
configNode->getChildren("object-name");
|
||||
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());
|
||||
else
|
||||
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*
|
||||
@@ -1825,12 +1820,13 @@ osg::Group*
|
||||
SGShadowAnimation::createAnimationGroup(osg::Group& parent)
|
||||
{
|
||||
SGSharedPtr<SGCondition const> condition = getCondition();
|
||||
if (!condition)
|
||||
return 0;
|
||||
|
||||
osg::Group* group = new osg::Group;
|
||||
group->setName("shadow animation");
|
||||
group->setUpdateCallback(new UpdateCallback(condition));
|
||||
if (condition)
|
||||
group->setUpdateCallback(new UpdateCallback(condition));
|
||||
else
|
||||
group->setNodeMask(~SG_NODEMASK_CASTSHADOW_BIT & group->getNodeMask());
|
||||
parent.addChild(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,6 @@ private:
|
||||
std::list<std::string> _objectNames;
|
||||
std::list<osg::ref_ptr<osg::Node> > _installedAnimations;
|
||||
bool _enableHOT;
|
||||
bool _disableShadow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ osg::Group* Particles::getCommonRoot()
|
||||
commonGeode.get()->setName("common particle system geode");
|
||||
commonRoot.get()->addChild(commonGeode.get());
|
||||
commonRoot.get()->addChild(psu.get());
|
||||
commonRoot->setNodeMask( ~simgear::MODELLIGHT_BIT );
|
||||
}
|
||||
return commonRoot.get();
|
||||
}
|
||||
|
||||
@@ -167,9 +167,10 @@ void CloudShaderGeometry::generateGeometry()
|
||||
|
||||
// Create front and back polygons so we don't need to screw around
|
||||
// with two-sided lighting in the shader.
|
||||
osg::Vec3Array& v = *(new osg::Vec3Array(4 * numsprites));
|
||||
osg::Vec4Array& c = *(new osg::Vec4Array(4 * numsprites));
|
||||
osg::Vec2Array& t = *(new osg::Vec2Array(4 * numsprites));
|
||||
osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;
|
||||
osg::ref_ptr<osg::Vec3Array> n = new osg::Vec3Array;
|
||||
osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;
|
||||
osg::ref_ptr<osg::Vec2Array> t = new osg::Vec2Array;
|
||||
|
||||
int idx = 0;
|
||||
|
||||
@@ -182,46 +183,47 @@ void CloudShaderGeometry::generateGeometry()
|
||||
float ch = 0.5f * iter->height;
|
||||
|
||||
// Create the vertices
|
||||
v[4*idx ].set(0.0f, -cw, -ch);
|
||||
v[4*idx+1].set(0.0f, cw, -ch);
|
||||
v[4*idx+2].set(0.0f, cw, ch);
|
||||
v[4*idx+3].set(0.0f, -cw, ch);
|
||||
v->push_back(osg::Vec3(0.0f, -cw, -ch));
|
||||
v->push_back(osg::Vec3(0.0f, cw, -ch));
|
||||
v->push_back(osg::Vec3(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
|
||||
// from the texture index, and the number
|
||||
// of textures in the image
|
||||
int x = iter->texture_index_x;
|
||||
int y = iter->texture_index_y;
|
||||
|
||||
t[4*idx ].set( (float) x / varieties_x, (float) y / varieties_y);
|
||||
t[4*idx+1].set( (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[4*idx+3].set( (float) x / varieties_x, (float) (y + 1) / varieties_y);
|
||||
|
||||
t->push_back(osg::Vec2( (float) x / varieties_x, (float) y / varieties_y));
|
||||
t->push_back(osg::Vec2( (float) (x + 1) / varieties_x, (float) y / varieties_y));
|
||||
t->push_back(osg::Vec2( (float) (x + 1) / 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
|
||||
c[4*idx ].set(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[4*idx+2].set(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));
|
||||
c->push_back(osg::Vec4(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->push_back(osg::Vec4(iter->position.x(), iter->position.y(), iter->position.z(), zscale));
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
//Quads now created, add it to the geometry.
|
||||
osg::Geometry* geom = new osg::Geometry;
|
||||
geom->setVertexArray(&v);
|
||||
geom->setTexCoordArray(0, &t);
|
||||
|
||||
// The normal isn't actually use in lighting, so we simply bind overall.
|
||||
osg::Vec3Array& n = *(new osg::Vec3Array(4));
|
||||
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->setVertexArray(v);
|
||||
geom->setTexCoordArray(0, t);
|
||||
geom->setNormalArray(n);
|
||||
geom->setNormalBinding(Geometry::BIND_PER_VERTEX);
|
||||
geom->setColorArray(c);
|
||||
geom->setColorBinding(Geometry::BIND_PER_VERTEX);
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numsprites*4));
|
||||
_geometry = geom;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/util/StateAttributeFactory.hxx>
|
||||
#include <simgear/scene/util/SGUpdateVisitor.hxx>
|
||||
#include <simgear/scene/util/RenderConstants.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#include <osg/BlendFunc>
|
||||
@@ -248,6 +249,7 @@ osg::ref_ptr<EffectGeode> SGNewCloud::genCloud() {
|
||||
geode->addDrawable(sg);
|
||||
geode->setName("3D cloud");
|
||||
geode->setEffect(effect.get());
|
||||
geode->setNodeMask( ~simgear::MODELLIGHT_BIT );
|
||||
|
||||
return geode;
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ void addBuildingToLeafGeode(Geode* geode, const SGBuildingBin::Building& buildin
|
||||
|
||||
// Get or create geometry.
|
||||
osg::ref_ptr<osg::Geometry> geom;
|
||||
osg::Vec3Array* v = new osg::Vec3Array;
|
||||
osg::Vec2Array* t = new osg::Vec2Array;
|
||||
osg::Vec4Array* c = new osg::Vec4Array; // single value
|
||||
osg::Vec3Array* n = new osg::Vec3Array;
|
||||
osg::ref_ptr<osg::Vec3Array> v;
|
||||
osg::ref_ptr<osg::Vec2Array> t;
|
||||
osg::ref_ptr<osg::Vec4Array> c;
|
||||
osg::ref_ptr<osg::Vec3Array> n;
|
||||
|
||||
if (geode->getNumDrawables() == 0) {
|
||||
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)
|
||||
->setStringValue(bin->texture);
|
||||
|
||||
// Light map - n=1
|
||||
params->getChild("texture", 1, true)->getChild("image", 0, true)
|
||||
// Light map - n=3
|
||||
params->getChild("texture", 3, true)->getChild("image", 0, true)
|
||||
->setStringValue(bin->lightMap);
|
||||
|
||||
effect = makeEffect(effectProp, true, options);
|
||||
|
||||
@@ -553,12 +553,12 @@ struct SGTileGeometryBin {
|
||||
float b = mt_rand(&seed) * stepv1;
|
||||
|
||||
// Place an object each unit of area
|
||||
while ( num > 1.0 ) {
|
||||
while (num > 1.0) {
|
||||
|
||||
// Set the next location to place a building
|
||||
a += stepv0;
|
||||
|
||||
if ( a + b > 1.0f ) {
|
||||
if ((a + b) > 1.0f) {
|
||||
// Reached the end of the scan-line on v0. Reset and increment
|
||||
// scan-line on v1
|
||||
a = mt_rand(&seed) * stepv0;
|
||||
@@ -567,8 +567,15 @@ struct SGTileGeometryBin {
|
||||
|
||||
if (b > 1.0f) {
|
||||
// In a degenerate case of a single point, we might be outside the
|
||||
// scanline.
|
||||
b = mt_rand(&seed) * stepv1;
|
||||
// scanline. Note that we need to still ensure that a+b < 1.
|
||||
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;
|
||||
@@ -1153,7 +1160,7 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
|
||||
osg::LOD* lightLOD = new osg::LOD;
|
||||
lightLOD->addChild(lightGroup.get(), 0, 30000);
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ enum NodeMask {
|
||||
// Everything else that isn't terrain. Initially for clouds;
|
||||
// eventually for other models?
|
||||
MODEL_BIT = (1 << 12),
|
||||
MODELLIGHT_BIT = (1 << 13)
|
||||
MODELLIGHT_BIT = (1 << 13),
|
||||
PERMANENTLIGHT_BIT = (1 << 14)
|
||||
};
|
||||
|
||||
// Theory of bin numbering:
|
||||
|
||||
Reference in New Issue
Block a user