Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7f151ad02 | ||
|
|
0710b781d3 | ||
|
|
7c01ad6917 | ||
|
|
56d2f06631 | ||
|
|
9e47911b19 | ||
|
|
ef80497fbe | ||
|
|
e22cf106c2 | ||
|
|
5ffb270ec1 | ||
|
|
f85f3b0f25 | ||
|
|
e7ec83d626 | ||
|
|
11479cd8c3 | ||
|
|
176e760de1 | ||
|
|
430c60ed1a | ||
|
|
dfea3623f6 | ||
|
|
b38783e4cb | ||
|
|
9382a4c21b | ||
|
|
3cd4c5566f | ||
|
|
601c0977df | ||
|
|
c56f036bab | ||
|
|
44dd50c0ef | ||
|
|
56919ae45f | ||
|
|
6c14e7127d | ||
|
|
578af00b0d | ||
|
|
d6c0bf69b6 | ||
|
|
e8884b4ec0 | ||
|
|
5e79609955 | ||
|
|
4950c96f1c | ||
|
|
51b0cf535e | ||
|
|
4cc17a7f6e |
+27
-3
@@ -8,7 +8,7 @@ dnl Require at least automake 2.52
|
|||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
|
|
||||||
dnl Initialize the automake stuff
|
dnl Initialize the automake stuff
|
||||||
AM_INIT_AUTOMAKE(SimGear, 1.9.1)
|
AM_INIT_AUTOMAKE(SimGear, 2.0.0-rc2)
|
||||||
|
|
||||||
dnl Specify KAI C++ compiler and flags.
|
dnl Specify KAI C++ compiler and flags.
|
||||||
dnl Borrowed with slight modification from blitz distribution.
|
dnl Borrowed with slight modification from blitz distribution.
|
||||||
@@ -144,6 +144,15 @@ AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix
|
|||||||
|
|
||||||
if test "x$with_osg_framework" != "x"; then
|
if test "x$with_osg_framework" != "x"; then
|
||||||
echo "osg framework prefix is $with_osg_framework"
|
echo "osg framework prefix is $with_osg_framework"
|
||||||
|
CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
|
||||||
|
export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl specifying OpenAL.framework (for user provided OpenAL.framework / ALUT)
|
||||||
|
AC_ARG_WITH(openal_framework, [ --with-openal-framework=PREFIX Speicfy the prefix path to OpenAL.framework ])
|
||||||
|
|
||||||
|
if test "x$with_openal_framework" != "x"; then
|
||||||
|
echo "OpenAL framework prefix is $with_openal_framework"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Determine an extra directories to add to include/lib search paths
|
dnl Determine an extra directories to add to include/lib search paths
|
||||||
@@ -305,9 +314,18 @@ case "${host}" in
|
|||||||
|
|
||||||
LIBS="$LIBS -framework IOKit -framework OpenAL"
|
LIBS="$LIBS -framework IOKit -framework OpenAL"
|
||||||
openal_LIBS="$LIBS"
|
openal_LIBS="$LIBS"
|
||||||
# not sure how to test if OpenAL exists on MacOS (does it come by default?)
|
|
||||||
OPENAL_OK="yes"
|
OPENAL_OK="yes"
|
||||||
ALUT_OK="yes"
|
ALUT_OK="no"
|
||||||
|
|
||||||
|
if test "x$with_openal_lib" != "x"; then
|
||||||
|
echo "libopenal is not supported on Mac OS platform."
|
||||||
|
openal_LIBS=""
|
||||||
|
fi
|
||||||
|
OPENAL_OK="yes"
|
||||||
|
# Looking for alut.h, if found assume that it is a part of
|
||||||
|
# the OpenAL package.
|
||||||
|
AC_CHECK_HEADERS([OpenAL/alut.h],[ALUT_OK="yes"])
|
||||||
|
|
||||||
|
|
||||||
dnl Thank you Christian Bauer from SheepSaver
|
dnl Thank you Christian Bauer from SheepSaver
|
||||||
dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
|
dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
|
||||||
@@ -338,6 +356,12 @@ case "${host}" in
|
|||||||
AS_VAR_POPDEF([ac_Framework])dnl
|
AS_VAR_POPDEF([ac_Framework])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Check for OpenAL.framework when --with-openal-framework is specified
|
||||||
|
dnl Of cource OpenAL.framework needs to have alut.h
|
||||||
|
if test "x$with_openal_framework" != "x"; then
|
||||||
|
AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/alut.h>], $with_openal_framework)
|
||||||
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -1003,7 +1003,6 @@
|
|||||||
RelativePath="..\..\simgear\props\ExtendedPropertyAdapter.hxx"
|
RelativePath="..\..\simgear\props\ExtendedPropertyAdapter.hxx"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\simgear\props\props.cxx"
|
RelativePath="..\..\simgear\props\props.cxx"
|
||||||
>
|
>
|
||||||
@@ -1156,6 +1155,14 @@
|
|||||||
RelativePath="..\..\simgear\scene\model\SGScaleTransform.hxx"
|
RelativePath="..\..\simgear\scene\model\SGScaleTransform.hxx"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\simgear\scene\model\SGText.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\simgear\scene\model\SGText.hxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\simgear\scene\model\SGTranslateTransform.cxx"
|
RelativePath="..\..\simgear\scene\model\SGTranslateTransform.cxx"
|
||||||
>
|
>
|
||||||
@@ -1168,18 +1175,18 @@
|
|||||||
RelativePath="..\..\simgear\scene\model\shadanim.cxx"
|
RelativePath="..\..\simgear\scene\model\shadanim.cxx"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\simgear\scene\model\SGText.cxx"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\simgear\scene\model\SGText.hxx"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Lib_sgsound"
|
Name="Lib_sgsound"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\simgear\sound\sample_group.cxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\simgear\sound\sample_group.hxx"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\simgear\sound\sample_openal.cxx"
|
RelativePath="..\..\simgear\sound\sample_openal.cxx"
|
||||||
>
|
>
|
||||||
@@ -1952,7 +1959,7 @@
|
|||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\simgear\simgear_config.h-msvc71"
|
RelativePath="..\..\simgear\simgear_config.h-msvc90"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public:
|
|||||||
static double courseDeg(const SGGeoc& from, const SGGeoc& to);
|
static double courseDeg(const SGGeoc& from, const SGGeoc& to);
|
||||||
static double distanceM(const SGGeoc& from, const SGGeoc& to);
|
static double distanceM(const SGGeoc& from, const SGGeoc& to);
|
||||||
|
|
||||||
|
// Compare two geocentric positions for equality
|
||||||
|
bool operator == ( const SGGeoc & other ) const;
|
||||||
private:
|
private:
|
||||||
/// This one is private since construction is not unique if you do
|
/// This one is private since construction is not unique if you do
|
||||||
/// not know the units of the arguments, use the factory methods for
|
/// not know the units of the arguments, use the factory methods for
|
||||||
@@ -323,6 +325,15 @@ SGGeoc::distanceM(const SGGeoc& from, const SGGeoc& to)
|
|||||||
return SGGeodesy::distanceM(from, to);
|
return SGGeodesy::distanceM(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool
|
||||||
|
SGGeoc::operator == ( const SGGeoc & other ) const
|
||||||
|
{
|
||||||
|
return _lon == other._lon &&
|
||||||
|
_lat == other._lat &&
|
||||||
|
_radius == other._radius;
|
||||||
|
}
|
||||||
|
|
||||||
/// Output to an ostream
|
/// Output to an ostream
|
||||||
template<typename char_type, typename traits_type>
|
template<typename char_type, typename traits_type>
|
||||||
inline
|
inline
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ public:
|
|||||||
/// Set the geodetic elevation from the argument given in feet
|
/// Set the geodetic elevation from the argument given in feet
|
||||||
void setElevationFt(double elevation);
|
void setElevationFt(double elevation);
|
||||||
|
|
||||||
|
// Compare two geodetic positions for equality
|
||||||
|
bool operator == ( const SGGeod & other ) const;
|
||||||
|
|
||||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||||
// Create a local coordinate frame in the earth-centered frame of
|
// Create a local coordinate frame in the earth-centered frame of
|
||||||
// reference. X points north, Z points down.
|
// reference. X points north, Z points down.
|
||||||
@@ -350,6 +353,15 @@ SGGeod::setElevationFt(double elevation)
|
|||||||
_elevation = elevation*SG_FEET_TO_METER;
|
_elevation = elevation*SG_FEET_TO_METER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool
|
||||||
|
SGGeod::operator == ( const SGGeod & other ) const
|
||||||
|
{
|
||||||
|
return _lon == other._lon &&
|
||||||
|
_lat == other._lat &&
|
||||||
|
_elevation == other._elevation;
|
||||||
|
}
|
||||||
|
|
||||||
/// Output to an ostream
|
/// Output to an ostream
|
||||||
template<typename char_type, typename traits_type>
|
template<typename char_type, typename traits_type>
|
||||||
inline
|
inline
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ SGGeodesy::courseRad(const SGGeoc& from, const SGGeoc& to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
SGGeodesy::distanceM(const SGGeoc& from, const SGGeoc& to)
|
SGGeodesy::distanceRad(const SGGeoc& from, const SGGeoc& to)
|
||||||
{
|
{
|
||||||
// d = 2*asin(sqrt((sin((lat1-lat2)/2))^2 +
|
// d = 2*asin(sqrt((sin((lat1-lat2)/2))^2 +
|
||||||
// cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
|
// cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
|
||||||
@@ -550,5 +550,12 @@ SGGeodesy::distanceM(const SGGeoc& from, const SGGeoc& to)
|
|||||||
double tmp2 = sin(0.5*(from.getLongitudeRad() - to.getLongitudeRad()));
|
double tmp2 = sin(0.5*(from.getLongitudeRad() - to.getLongitudeRad()));
|
||||||
double square = tmp1*tmp1 + cosLatFrom*cosLatTo*tmp2*tmp2;
|
double square = tmp1*tmp1 + cosLatFrom*cosLatTo*tmp2*tmp2;
|
||||||
double s = SGMiscd::min(sqrt(SGMiscd::max(square, 0)), 1);
|
double s = SGMiscd::min(sqrt(SGMiscd::max(square, 0)), 1);
|
||||||
return 2 * asin(s) * SG_RAD_TO_NM * SG_NM_TO_METER;
|
return 2 * asin(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double
|
||||||
|
SGGeodesy::distanceM(const SGGeoc& from, const SGGeoc& to)
|
||||||
|
{
|
||||||
|
return distanceRad(from, to) * SG_RAD_TO_NM * SG_NM_TO_METER;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
static void advanceRadM(const SGGeoc& geoc, double course, double distance,
|
static void advanceRadM(const SGGeoc& geoc, double course, double distance,
|
||||||
SGGeoc& result);
|
SGGeoc& result);
|
||||||
static double courseRad(const SGGeoc& from, const SGGeoc& to);
|
static double courseRad(const SGGeoc& from, const SGGeoc& to);
|
||||||
|
static double distanceRad(const SGGeoc& from, const SGGeoc& to);
|
||||||
static double distanceM(const SGGeoc& from, const SGGeoc& to);
|
static double distanceM(const SGGeoc& from, const SGGeoc& to);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "AtomicChangeListener.hxx"
|
#include "AtomicChangeListener.hxx"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public:
|
|||||||
else
|
else
|
||||||
return itr->second.ptr();
|
return itr->second.ptr();
|
||||||
}
|
}
|
||||||
template<typename T> friend class InstallAttributeBuilder;
|
template<typename T> friend struct InstallAttributeBuilder;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ EffectMap effectMap;
|
|||||||
|
|
||||||
double SGNewCloud::sprite_density = 1.0;
|
double SGNewCloud::sprite_density = 1.0;
|
||||||
|
|
||||||
|
|
||||||
SGNewCloud::SGNewCloud(string type,
|
SGNewCloud::SGNewCloud(string type,
|
||||||
const SGPath &tex_path,
|
const SGPath &tex_path,
|
||||||
string tex,
|
string tex,
|
||||||
@@ -214,7 +213,7 @@ osg::ref_ptr<EffectGeode> SGNewCloud::genCloud() {
|
|||||||
z = height * cos(elev) * 0.5f;
|
z = height * cos(elev) * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the height and width as scaling factors on the minimum size (used to create the quad)
|
// Determine the height and width as scaling factors on the minimum size (used to create the quad).
|
||||||
float sprite_width = 1.0f + sg_random() * (max_sprite_width - min_sprite_width) / min_sprite_width;
|
float sprite_width = 1.0f + sg_random() * (max_sprite_width - min_sprite_width) / min_sprite_width;
|
||||||
float sprite_height = 1.0f + sg_random() * (max_sprite_height - min_sprite_height) / min_sprite_height;
|
float sprite_height = 1.0f + sg_random() * (max_sprite_height - min_sprite_height) / min_sprite_height;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -106,6 +106,10 @@ SGMakeSign(SGMaterialLib *matlib, const string& path, const string& content)
|
|||||||
osg::Group* object = new osg::Group;
|
osg::Group* object = new osg::Group;
|
||||||
object->setName(content);
|
object->setName(content);
|
||||||
|
|
||||||
|
SGMaterial *material = 0;
|
||||||
|
Effect *lighted_state = 0;
|
||||||
|
Effect *unlighted_state = 0;
|
||||||
|
|
||||||
// Part I: parse & measure
|
// Part I: parse & measure
|
||||||
for (const char *s = content.data(); *s; s++) {
|
for (const char *s = content.data(); *s; s++) {
|
||||||
string name;
|
string name;
|
||||||
@@ -215,31 +219,32 @@ SGMakeSign(SGMaterialLib *matlib, const string& path, const string& content)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newmat.size()) {
|
||||||
|
SGMaterial *m = matlib->find(newmat);
|
||||||
|
if (!m) {
|
||||||
|
// log error, but keep using previous material to at least show something
|
||||||
|
SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "ignoring unknown material `" << newmat << '\'');
|
||||||
|
} else {
|
||||||
|
material = m;
|
||||||
|
// set material states (lighted & unlighted)
|
||||||
|
lighted_state = material->get_effect();
|
||||||
|
newmat.append(".unlighted");
|
||||||
|
|
||||||
if (newmat.size() == 0 )
|
m = matlib->find(newmat);
|
||||||
continue;
|
if (m) {
|
||||||
|
unlighted_state = m->get_effect();
|
||||||
SGMaterial *material = matlib->find(newmat);
|
} else {
|
||||||
if (!material) {
|
SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "ignoring unknown material `" << newmat << '\'');
|
||||||
SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "ignoring unknown material `" << newmat << '\'');
|
unlighted_state = lighted_state;
|
||||||
continue;
|
}
|
||||||
|
}
|
||||||
|
newmat.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This can only happen if the default material is missing.
|
||||||
// set material states (lighted & unlighted)
|
// Error has been already logged in the block above.
|
||||||
Effect *lighted_state = material->get_effect();
|
if (!material) continue;
|
||||||
Effect *unlighted_state;
|
|
||||||
string u = newmat + ".unlighted";
|
|
||||||
|
|
||||||
SGMaterial *m = matlib->find(u);
|
|
||||||
if (m) {
|
|
||||||
unlighted_state = m->get_effect();
|
|
||||||
} else {
|
|
||||||
SG_LOG(SG_TERRAIN, SG_ALERT, SIGN "ignoring unknown material `" << u << '\'');
|
|
||||||
unlighted_state = lighted_state;
|
|
||||||
}
|
|
||||||
newmat = "";
|
|
||||||
|
|
||||||
SGMaterialGlyph *glyph = material->get_glyph(name);
|
SGMaterialGlyph *glyph = material->get_glyph(name);
|
||||||
if (!glyph) {
|
if (!glyph) {
|
||||||
SG_LOG( SG_TERRAIN, SG_ALERT, SIGN "unsupported glyph `" << *s << '\'');
|
SG_LOG( SG_TERRAIN, SG_ALERT, SIGN "unsupported glyph `" << *s << '\'');
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
// Boston, MA 02111-1307, USA.
|
// Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "CopyOp.hxx"
|
#include "CopyOp.hxx"
|
||||||
|
|
||||||
#include <simgear/scene/material/Effect.hxx>
|
#include <simgear/scene/material/Effect.hxx>
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
/* simgear_config.h. Generated for MSCV++ 9.0 */
|
||||||
|
|
||||||
|
/* Define if the X Window System is missing or not being used. */
|
||||||
|
#define X_DISPLAY_MISSING 1
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define if you don't have vprintf but do have _doprnt. */
|
||||||
|
/* #undef HAVE_DOPRNT */
|
||||||
|
|
||||||
|
/* Define if you have the vprintf function. */
|
||||||
|
#define HAVE_VPRINTF 1
|
||||||
|
|
||||||
|
/* Define to package name */
|
||||||
|
#define PACKAGE "FlightGear"
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
|
/* #undef TIME_WITH_SYS_TIME */
|
||||||
|
|
||||||
|
/* Define if your <sys/time.h> declares struct tm. */
|
||||||
|
/* #define TM_IN_SYS_TIME 1 */
|
||||||
|
|
||||||
|
/* Define to version number */
|
||||||
|
#define VERSION "1.99.4"
|
||||||
|
|
||||||
|
/* Define if compiling on a Winbloze (95, NT, etc.) platform */
|
||||||
|
#define WIN32 1
|
||||||
|
|
||||||
|
/* Define if you have the GetLocalTime function. */
|
||||||
|
#define HAVE_GETLOCALTIME 1
|
||||||
|
|
||||||
|
/* Define if you have the ftime function. */
|
||||||
|
/* #define HAVE_FTIME 1 */
|
||||||
|
|
||||||
|
/* Define if you have the getitimer function. */
|
||||||
|
/* #define HAVE_GETITIMER 1 */
|
||||||
|
|
||||||
|
/* Define if you have the getrusage function. */
|
||||||
|
/* #define HAVE_GETRUSAGE 1 */
|
||||||
|
|
||||||
|
/* Define if you have the gettimeofday function. */
|
||||||
|
/* #define HAVE_GETTIMEOFDAY 1 */
|
||||||
|
|
||||||
|
/* Define if you have the mktime function. */
|
||||||
|
#define HAVE_MKTIME 1
|
||||||
|
|
||||||
|
/* Define if you have the rand function. */
|
||||||
|
#define HAVE_RAND 1
|
||||||
|
|
||||||
|
/* Define if you have the random function. */
|
||||||
|
#define HAVE_RANDOM 1
|
||||||
|
|
||||||
|
/* Define if you have the rint function. */
|
||||||
|
/* #define HAVE_RINT 1 */
|
||||||
|
|
||||||
|
/* Define if you have the setitimer function. */
|
||||||
|
/* #define HAVE_SETITIMER 1 */
|
||||||
|
|
||||||
|
/* Define if you have the signal function. */
|
||||||
|
#define HAVE_SIGNAL 1
|
||||||
|
|
||||||
|
/* Define if you have the strstr function. */
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
|
||||||
|
/* Define if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <getopt.h> header file. */
|
||||||
|
/* #define HAVE_GETOPT_H 1 */
|
||||||
|
|
||||||
|
/* Define if you have the <malloc.h> header file. */
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
|
/* #define HAVE_SYS_TIME_H 1 */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/timeb.h> header file. */
|
||||||
|
#define HAVE_SYS_TIMEB_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <unistd.h> header file. */
|
||||||
|
/* #define HAVE_UNISTD_H 1 */
|
||||||
|
|
||||||
|
/* Define if you have the <values.h> header file. */
|
||||||
|
/* #define HAVE_VALUES_H 1 */
|
||||||
|
|
||||||
|
/* Define if you have the <winbase.h> header file. */
|
||||||
|
#define HAVE_WINBASE_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <windows.h> header file. */
|
||||||
|
#define HAVE_WINDOWS_H 1
|
||||||
|
|
||||||
|
/* Define if you have the GL library (-lGL). */
|
||||||
|
#define HAVE_LIBGL 1
|
||||||
|
|
||||||
|
/* Define if you have the GLU library (-lGLU). */
|
||||||
|
#define HAVE_LIBGLU 1
|
||||||
|
|
||||||
|
/* Define if you have the GLcore library (-lGLcore). */
|
||||||
|
/* #undef HAVE_LIBGLCORE */
|
||||||
|
|
||||||
|
/* Define if you have the ICE library (-lICE). */
|
||||||
|
/* #define HAVE_LIBICE 1 */
|
||||||
|
|
||||||
|
/* Define if you have the MesaGL library (-lMesaGL). */
|
||||||
|
/* #undef HAVE_LIBMESAGL */
|
||||||
|
|
||||||
|
/* Define if you have the MesaGLU library (-lMesaGLU). */
|
||||||
|
/* #undef HAVE_LIBMESAGLU */
|
||||||
|
|
||||||
|
/* Define if you have the SM library (-lSM). */
|
||||||
|
/* #define HAVE_LIBSM 1 */
|
||||||
|
|
||||||
|
/* Define if you have the X11 library (-lX11). */
|
||||||
|
/* #define HAVE_LIBX11 1 */
|
||||||
|
|
||||||
|
/* Define if you have the Xext library (-lXext). */
|
||||||
|
/* #define HAVE_LIBXEXT 1 */
|
||||||
|
|
||||||
|
/* Define if you have the Xi library (-lXi). */
|
||||||
|
/* #define HAVE_LIBXI 1 */
|
||||||
|
|
||||||
|
/* Define if you have the Xmu library (-lXmu). */
|
||||||
|
/* #define HAVE_LIBXMU 1 */
|
||||||
|
|
||||||
|
/* Define if you have the Xt library (-lXt). */
|
||||||
|
/* #define HAVE_LIBXT 1 */
|
||||||
|
|
||||||
|
/* Define if you have the glut library (-lglut). */
|
||||||
|
#define HAVE_LIBGLUT 1
|
||||||
|
|
||||||
|
/* Define if you have the m library (-lm). */
|
||||||
|
#define HAVE_LIBM 1
|
||||||
|
|
||||||
|
/* Define if you have the socket library (-lsocket). */
|
||||||
|
/* #undef HAVE_LIBSOCKET */
|
||||||
|
|
||||||
|
/* Define if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
|
||||||
|
#define GLUT_H <GL/glut.h>
|
||||||
|
|
||||||
|
#define NOMINMAX 1
|
||||||
@@ -69,7 +69,9 @@ SGSoundMgr::SGSoundMgr() :
|
|||||||
_geod_pos(SGGeod::fromCart(SGVec3d::zeros())),
|
_geod_pos(SGGeod::fromCart(SGVec3d::zeros())),
|
||||||
_velocity(SGVec3d::zeros()),
|
_velocity(SGVec3d::zeros()),
|
||||||
_orientation(SGQuatd::zeros()),
|
_orientation(SGQuatd::zeros()),
|
||||||
_bad_doppler(false)
|
_bad_doppler(false),
|
||||||
|
_renderer("unknown"),
|
||||||
|
_vendor("unknown")
|
||||||
{
|
{
|
||||||
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
|
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
|
||||||
if (_alut_init == 0) {
|
if (_alut_init == 0) {
|
||||||
@@ -108,7 +110,9 @@ void SGSoundMgr::init(const char *devname) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_device = device;
|
||||||
ALCcontext *context = alcCreateContext(device, NULL);
|
ALCcontext *context = alcCreateContext(device, NULL);
|
||||||
|
testForALCError("context creation.");
|
||||||
if ( testForError(context, "Unable to create a valid context.") ) {
|
if ( testForError(context, "Unable to create a valid context.") ) {
|
||||||
alcCloseDevice (device);
|
alcCloseDevice (device);
|
||||||
return;
|
return;
|
||||||
@@ -158,10 +162,10 @@ void SGSoundMgr::init(const char *devname) {
|
|||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string vendor = (const char *)alGetString(AL_VENDOR);
|
_vendor = (const char *)alGetString(AL_VENDOR);
|
||||||
string renderer = (const char *)alGetString(AL_RENDERER);
|
_renderer = (const char *)alGetString(AL_RENDERER);
|
||||||
if ( vendor != "OpenAL Community" ||
|
if ( (_vendor != "OpenAL Community" && _vendor != "Apple Computer Inc.") ||
|
||||||
(renderer != "Software" && renderer != "OpenAL Sample Implementation")
|
(_renderer != "Software" && _renderer != "OpenAL Sample Implementation")
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_bad_doppler = true;
|
_bad_doppler = true;
|
||||||
@@ -220,6 +224,9 @@ void SGSoundMgr::stop() {
|
|||||||
alcDestroyContext(_context);
|
alcDestroyContext(_context);
|
||||||
alcCloseDevice(_device);
|
alcCloseDevice(_device);
|
||||||
_context = NULL;
|
_context = NULL;
|
||||||
|
|
||||||
|
_renderer = "unknown";
|
||||||
|
_vendor = "unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,12 +554,15 @@ bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt,
|
|||||||
|
|
||||||
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
|
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
|
||||||
ALfloat freqf;
|
ALfloat freqf;
|
||||||
|
// ignore previous errors to prevent the system from halting on silly errors
|
||||||
|
alGetError();
|
||||||
|
alcGetError(_device);
|
||||||
data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf );
|
data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf );
|
||||||
freq = (ALsizei)freqf;
|
freq = (ALsizei)freqf;
|
||||||
if (data == NULL) {
|
int error = alutGetError();
|
||||||
int error = alutGetError();
|
if (data == NULL || error != ALUT_ERROR_NO_ERROR) {
|
||||||
string msg = "Failed to load wav file: ";
|
string msg = "Failed to load wav file: ";
|
||||||
msg.append(alutGetErrorString(error));
|
msg.append(alutGetErrorString(error));
|
||||||
throw sg_io_exception(msg.c_str(), sg_location(samplepath));
|
throw sg_io_exception(msg.c_str(), sg_location(samplepath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -568,7 +578,18 @@ bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt,
|
|||||||
ALenum error = alGetError();
|
ALenum error = alGetError();
|
||||||
if ( error != AL_NO_ERROR ) {
|
if ( error != AL_NO_ERROR ) {
|
||||||
string msg = "Failed to load wav file: ";
|
string msg = "Failed to load wav file: ";
|
||||||
msg.append(alGetString(error));
|
const ALchar *errorString = alGetString(error);
|
||||||
|
if (errorString) {
|
||||||
|
msg.append(errorString);
|
||||||
|
} else {
|
||||||
|
// alGetString returns NULL when an unexpected or OS specific error
|
||||||
|
// occurs: e.g. -43 on Mac when file is not found.
|
||||||
|
// In this case, alGetString() sets 'Invalid Enum' error, so
|
||||||
|
// showing with the original error number is helpful.
|
||||||
|
stringstream ss;
|
||||||
|
ss << alGetString(alGetError()) << "(" << error << ")";
|
||||||
|
msg.append(ss.str());
|
||||||
|
}
|
||||||
throw sg_io_exception(msg.c_str(), sg_location(samplepath));
|
throw sg_io_exception(msg.c_str(), sg_location(samplepath));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,6 +289,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
vector<const char*> get_available_devices();
|
vector<const char*> get_available_devices();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current OpenAL vendor or rendering backend.
|
||||||
|
*/
|
||||||
|
const string& get_vendor() { return _vendor; }
|
||||||
|
const string& get_renderer() { return _renderer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int _alut_init;
|
static int _alut_init;
|
||||||
|
|
||||||
@@ -321,6 +327,8 @@ private:
|
|||||||
vector<ALuint> _sources_in_use;
|
vector<ALuint> _sources_in_use;
|
||||||
|
|
||||||
bool _bad_doppler;
|
bool _bad_doppler;
|
||||||
|
string _renderer;
|
||||||
|
string _vendor;
|
||||||
|
|
||||||
bool testForALError(string s);
|
bool testForALError(string s);
|
||||||
bool testForALCError(string s);
|
bool testForALCError(string s);
|
||||||
|
|||||||
@@ -110,10 +110,11 @@ SGSubsystemGroup::SGSubsystemGroup ()
|
|||||||
|
|
||||||
SGSubsystemGroup::~SGSubsystemGroup ()
|
SGSubsystemGroup::~SGSubsystemGroup ()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _members.size(); i++)
|
// reverse order to prevent order dependency problems
|
||||||
|
for (unsigned int i = _members.size(); i > 0; i--)
|
||||||
{
|
{
|
||||||
_members[i]->printTimingStatistics();
|
_members[i-1]->printTimingStatistics();
|
||||||
delete _members[i];
|
delete _members[i-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +149,9 @@ SGSubsystemGroup::bind ()
|
|||||||
void
|
void
|
||||||
SGSubsystemGroup::unbind ()
|
SGSubsystemGroup::unbind ()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _members.size(); i++)
|
// reverse order to prevent order dependency problems
|
||||||
_members[i]->subsystem->unbind();
|
for (unsigned int i = _members.size(); i > 0; i--)
|
||||||
|
_members[i-1]->subsystem->unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -381,7 +383,8 @@ SGSubsystemMgr::bind ()
|
|||||||
void
|
void
|
||||||
SGSubsystemMgr::unbind ()
|
SGSubsystemMgr::unbind ()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_GROUPS; i++)
|
// reverse order to prevent order dependency problems
|
||||||
|
for (int i = MAX_GROUPS-1; i >= 0; i--)
|
||||||
_groups[i].unbind();
|
_groups[i].unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1365,6 +1365,10 @@ int getEncodingIndex(const char *name)
|
|||||||
for (i = 0; i < sizeof(encodingNames)/sizeof(encodingNames[0]); i++)
|
for (i = 0; i < sizeof(encodingNames)/sizeof(encodingNames[0]); i++)
|
||||||
if (streqci(name, encodingNames[i]))
|
if (streqci(name, encodingNames[i]))
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
if (streqci(name, "ASCII"))
|
||||||
|
return US_ASCII_ENC;
|
||||||
|
|
||||||
return UNKNOWN_ENC;
|
return UNKNOWN_ENC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user