[Python-ogre-commit] SF.net SVN: python-ogre: [462] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
|
From: <and...@us...> - 2007-10-25 05:38:33
|
Revision: 462
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=462&view=rev
Author: andy_miller
Date: 2007-10-24 22:38:36 -0700 (Wed, 24 Oct 2007)
Log Message:
-----------
Again thanks to Dermont for a new wrapper -- libnoise !!!
Modified Paths:
--------------
trunk/python-ogre/PythonOgreConfig_nt.py
trunk/python-ogre/PythonOgreConfig_posix.py
trunk/python-ogre/SConstruct
trunk/python-ogre/environment.py
trunk/python-ogre/setup.py
Added Paths:
-----------
trunk/python-ogre/ThirdParty/noise/
trunk/python-ogre/ThirdParty/noise/Makefile
trunk/python-ogre/ThirdParty/noise/Sources
trunk/python-ogre/ThirdParty/noise/abs.cpp
trunk/python-ogre/ThirdParty/noise/add.cpp
trunk/python-ogre/ThirdParty/noise/basictypes.h
trunk/python-ogre/ThirdParty/noise/billow.cpp
trunk/python-ogre/ThirdParty/noise/blend.cpp
trunk/python-ogre/ThirdParty/noise/cache.cpp
trunk/python-ogre/ThirdParty/noise/checkerboard.cpp
trunk/python-ogre/ThirdParty/noise/clamp.cpp
trunk/python-ogre/ThirdParty/noise/const.cpp
trunk/python-ogre/ThirdParty/noise/curve.cpp
trunk/python-ogre/ThirdParty/noise/cylinder.cpp
trunk/python-ogre/ThirdParty/noise/cylinders.cpp
trunk/python-ogre/ThirdParty/noise/displace.cpp
trunk/python-ogre/ThirdParty/noise/exception.h
trunk/python-ogre/ThirdParty/noise/exponent.cpp
trunk/python-ogre/ThirdParty/noise/interp.h
trunk/python-ogre/ThirdParty/noise/invert.cpp
trunk/python-ogre/ThirdParty/noise/latlon.cpp
trunk/python-ogre/ThirdParty/noise/latlon.h
trunk/python-ogre/ThirdParty/noise/line.cpp
trunk/python-ogre/ThirdParty/noise/mathconsts.h
trunk/python-ogre/ThirdParty/noise/max.cpp
trunk/python-ogre/ThirdParty/noise/min.cpp
trunk/python-ogre/ThirdParty/noise/misc.h
trunk/python-ogre/ThirdParty/noise/model/
trunk/python-ogre/ThirdParty/noise/model/cylinder.h
trunk/python-ogre/ThirdParty/noise/model/line.h
trunk/python-ogre/ThirdParty/noise/model/model.h
trunk/python-ogre/ThirdParty/noise/model/plane.h
trunk/python-ogre/ThirdParty/noise/model/sphere.h
trunk/python-ogre/ThirdParty/noise/module/
trunk/python-ogre/ThirdParty/noise/module/abs.h
trunk/python-ogre/ThirdParty/noise/module/add.h
trunk/python-ogre/ThirdParty/noise/module/billow.h
trunk/python-ogre/ThirdParty/noise/module/blend.h
trunk/python-ogre/ThirdParty/noise/module/cache.h
trunk/python-ogre/ThirdParty/noise/module/checkerboard.h
trunk/python-ogre/ThirdParty/noise/module/clamp.h
trunk/python-ogre/ThirdParty/noise/module/const.h
trunk/python-ogre/ThirdParty/noise/module/curve.h
trunk/python-ogre/ThirdParty/noise/module/cylinders.h
trunk/python-ogre/ThirdParty/noise/module/displace.h
trunk/python-ogre/ThirdParty/noise/module/exponent.h
trunk/python-ogre/ThirdParty/noise/module/invert.h
trunk/python-ogre/ThirdParty/noise/module/max.h
trunk/python-ogre/ThirdParty/noise/module/min.h
trunk/python-ogre/ThirdParty/noise/module/module.h
trunk/python-ogre/ThirdParty/noise/module/modulebase.h
trunk/python-ogre/ThirdParty/noise/module/multiply.h
trunk/python-ogre/ThirdParty/noise/module/perlin.h
trunk/python-ogre/ThirdParty/noise/module/power.h
trunk/python-ogre/ThirdParty/noise/module/ridgedmulti.h
trunk/python-ogre/ThirdParty/noise/module/rotatepoint.h
trunk/python-ogre/ThirdParty/noise/module/scalebias.h
trunk/python-ogre/ThirdParty/noise/module/scalepoint.h
trunk/python-ogre/ThirdParty/noise/module/select.h
trunk/python-ogre/ThirdParty/noise/module/spheres.h
trunk/python-ogre/ThirdParty/noise/module/terrace.h
trunk/python-ogre/ThirdParty/noise/module/translatepoint.h
trunk/python-ogre/ThirdParty/noise/module/turbulence.h
trunk/python-ogre/ThirdParty/noise/module/voronoi.h
trunk/python-ogre/ThirdParty/noise/modulebase.cpp
trunk/python-ogre/ThirdParty/noise/multiply.cpp
trunk/python-ogre/ThirdParty/noise/noise.h
trunk/python-ogre/ThirdParty/noise/noisegen.cpp
trunk/python-ogre/ThirdParty/noise/noisegen.h
trunk/python-ogre/ThirdParty/noise/noiseutils.cpp
trunk/python-ogre/ThirdParty/noise/noiseutils.h
trunk/python-ogre/ThirdParty/noise/perlin.cpp
trunk/python-ogre/ThirdParty/noise/plane.cpp
trunk/python-ogre/ThirdParty/noise/power.cpp
trunk/python-ogre/ThirdParty/noise/ridgedmulti.cpp
trunk/python-ogre/ThirdParty/noise/rotatepoint.cpp
trunk/python-ogre/ThirdParty/noise/scalebias.cpp
trunk/python-ogre/ThirdParty/noise/scalepoint.cpp
trunk/python-ogre/ThirdParty/noise/select.cpp
trunk/python-ogre/ThirdParty/noise/sphere.cpp
trunk/python-ogre/ThirdParty/noise/spheres.cpp
trunk/python-ogre/ThirdParty/noise/terrace.cpp
trunk/python-ogre/ThirdParty/noise/translatepoint.cpp
trunk/python-ogre/ThirdParty/noise/turbulence.cpp
trunk/python-ogre/ThirdParty/noise/vectortable.h
trunk/python-ogre/ThirdParty/noise/voronoi.cpp
trunk/python-ogre/code_generators/noise/
trunk/python-ogre/code_generators/noise/customization_data.py
trunk/python-ogre/code_generators/noise/generate_code.py
trunk/python-ogre/code_generators/noise/hand_made_wrappers.py
trunk/python-ogre/code_generators/noise/noise_README
trunk/python-ogre/code_generators/noise/python_noise.h
trunk/python-ogre/code_generators/noise/python_noise_aliases.h
trunk/python-ogre/code_generators/noise/python_noise_sizeof.h
trunk/python-ogre/demos/noise/
trunk/python-ogre/demos/noise/Demo_Noise_01.py
trunk/python-ogre/demos/noise/SampleFramework.py
trunk/python-ogre/demos/noise/plugins.cfg
trunk/python-ogre/demos/noise/resources.cfg
trunk/python-ogre/packages_2.5/ogre/addons/noise/
trunk/python-ogre/packages_2.5/ogre/addons/noise/__init__.py
Modified: trunk/python-ogre/PythonOgreConfig_nt.py
===================================================================
--- trunk/python-ogre/PythonOgreConfig_nt.py 2007-10-24 12:02:21 UTC (rev 461)
+++ trunk/python-ogre/PythonOgreConfig_nt.py 2007-10-25 05:38:36 UTC (rev 462)
@@ -47,7 +47,9 @@
PATH_caelum = os.path.join(PATH_THIRDPARTY, 'caelum')
PATH_NxOgre= os.path.join(PATH_THIRDPARTY, 'nxogre')
# PATH_NxOgre= os.path.join(BASE_DIR, 'nxogre/NxOgre')
+PATH_noise= os.path.join(PATH_THIRDPARTY, 'noise')
+
PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg')
PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.62')
PATH_PhysX= "c:/program files/AGEIA Technologies/SDK/v2.7.2/SDKs"
@@ -136,6 +138,7 @@
PATH_INCLUDE_ogredshow = PATH_ogredshow
PATH_INCLUDE_plib = PATH_plib
PATH_INCLUDE_navi = os.path.join (PATH_navi,'include')
+PATH_INCLUDE_noise = PATH_noise
##PATH_INCLUDE_ogreforests = os.path.join (PATH_ogreforests,'include')
PATH_INCLUDE_ogreforests = PATH_ogreforests
Modified: trunk/python-ogre/PythonOgreConfig_posix.py
===================================================================
--- trunk/python-ogre/PythonOgreConfig_posix.py 2007-10-24 12:02:21 UTC (rev 461)
+++ trunk/python-ogre/PythonOgreConfig_posix.py 2007-10-25 05:38:36 UTC (rev 462)
@@ -49,6 +49,7 @@
PATH_plib = os.path.join(PATH_THIRDPARTY, 'plib')
PATH_et = os.path.join(PATH_THIRDPARTY, 'et')
PATH_caelum = os.path.join(PATH_THIRDPARTY, 'caelum')
+PATH_noise= os.path.join(PATH_THIRDPARTY, 'noise')
PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg')
PATH_NxOgre= os.path.join(PATH_THIRDPARTY, 'nxogre')
@@ -127,6 +128,7 @@
PATH_INCLUDE_ffmpeg = os.path.join (PATH_ffmpeg,'include')
PATH_INCLUDE_plib = PATH_plib
PATH_INCLUDE_navi = os.path.join (PATH_navi,'include')
+PATH_INCLUDE_noise = PATH_noise
PATH_INCLUDE_ogredshow = PATH_ogredshow
PATH_INCLUDE_ogreforests = PATH_ogreforests
Modified: trunk/python-ogre/SConstruct
===================================================================
--- trunk/python-ogre/SConstruct 2007-10-24 12:02:21 UTC (rev 461)
+++ trunk/python-ogre/SConstruct 2007-10-25 05:38:36 UTC (rev 462)
@@ -82,7 +82,7 @@
def get_linkflags():
if os.name=='nt':
#LINKFLAGS = " /NOLOGO /INCREMENTAL:NO /DLL /OPT:NOREF /OPT:NOICF /OPT:NOWIN98 /subsystem:console " # no change
- LINKFLAGS = " /NOLOGO /OPT:REF /INCREMENTAL:NO /DLL /OPT:ICF /OPT:NOWIN98 /subsystem:console " # 7 minutes 25% smaller 16.6 Meg
+ LINKFLAGS = " /MAP:FULL /MAPINFO:EXPORTS /NOLOGO /OPT:REF /INCREMENTAL:NO /DLL /OPT:ICF /OPT:NOWIN98 /subsystem:console " # 7 minutes 25% smaller 16.6 Meg
#LINKFLAGS = " /NOLOGO /INCREMENTAL:NO /DLL /subsystem:console " ### LONG Link , 80 minutes - 15.7 meg
elif os.name == 'posix':
if os.sys.platform <> 'darwin':
@@ -95,7 +95,7 @@
possible_projects = ['ogre' , 'ois', 'ogrerefapp', 'ogrenewt', 'cegui', 'ode',\
'ogreode', 'ogreal', 'quickgui', 'opcode', 'nxogre', 'bullet', 'physx', 'betagui','theora',\
'ogrevideoffmpeg', 'ogredshow', 'plib', 'ogrebulletc', 'ogrebulletd',
- 'ogreforests', 'et', 'navi', 'caelum' ] # , 'raknet'
+ 'ogreforests', 'et', 'navi', 'caelum', 'noise' ] # , 'raknet'
default_projects = ['ogre' , 'ois', 'ogrerefapp', 'ogrenewt', 'cegui', 'ode',\
'ogreode', 'ogreal', 'quickgui', 'opcode', 'nxogre', 'bullet', 'physx', 'betagui','theora',\
'ogrevideoffmpeg', 'ogredshow', 'plib', 'ogrebulletc', 'ogrebulletd',
@@ -165,9 +165,9 @@
## and lets have it install the output into the 'package_dir_name/ModuleName' dir and rename to the PydName
_env.AddPostAction(package,\
'mt.exe -nologo -manifest %(name)s.manifest -outputresource:%(name)s;2' % { 'name':package[index] } )
- #else:
- # _env.AddPostAction(package,\
- # '-strip -g -S -d --strip-debug -s %(name)s' % { 'name':package[index] } )
+ else:
+ _env.AddPostAction(package,\
+ '-strip -g -S -d --strip-debug -s %(name)s' % { 'name':package[index] } )
_env.InstallAs(os.path.join(environment.package_dir_name, cls.parent,
cls.ModuleName, cls.PydName),
Added: trunk/python-ogre/ThirdParty/noise/Makefile
===================================================================
--- trunk/python-ogre/ThirdParty/noise/Makefile (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/Makefile 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,56 @@
+LIBTOOL=libtool
+
+# defines source files and vpaths
+include Sources
+
+DEPENDS=$(SOURCES:.cpp=.d)
+
+# What source objects are we building?
+OBJECTS=$(SOURCES:.cpp=.o)
+
+.PHONY: all clean cleandeps cleanobjs cleanlib libnoise libnoise.so libnoise.so.0
+
+# hooks for future makefiles being able to make multiple SOs, or older SOs
+libnoise: libnoise.so libnoise.a libnoise.la
+libnoise.so: libnoise.so.0
+libnoise.so.0: libnoise.so.0.3
+
+# Real build targets
+libnoise.so.0.3: $(OBJECTS)
+ $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -shared -Wl,-soname=libnoise.so.0 -o $@ $(OBJECTS:.o=.lo)
+
+libnoise.a: $(OBJECTS)
+ $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
+libnoise.la: $(OBJECTS)
+ $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(OBJECTS:.o=.lo)
+
+clean: cleandeps cleanobjs cleanlib
+cleandeps:
+ -rm $(DEPENDS)
+cleanobjs:
+ -rm $(OBJECTS)
+ -rm $(OBJECTS:.o=.lo) #clean up after libtool
+ -rm -rf .libs model/.libs module/.libs
+cleanlib:
+ -rm libnoise.so.0.3
+ -rm libnoise.a
+ -rm libnoise.la
+
+# Utility rules
+# Generates dependancy files:
+%.d: %.cpp
+ @set -e; rm -f $@; \
+ $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+# C and C++ libtool (rather than raw CXX/CC) use
+%.o %.lo: %.cpp
+ $(LIBTOOL) --mode=compile $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $(@:.lo=.o)
+
+%.o %.lo: %.c
+ $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $(@:.lo=.o)
+
+# If dependancies have never been built this will produce a horde of
+# "file not found" warnings and *then* build the deps. Very odd.
+include $(DEPENDS)
Added: trunk/python-ogre/ThirdParty/noise/Sources
===================================================================
--- trunk/python-ogre/ThirdParty/noise/Sources (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/Sources 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,80 @@
+SOURCES=../src/latlon.cpp \
+ ../src/noisegen.cpp \
+ ../src/model/cylinder.cpp \
+ ../src/model/line.cpp \
+ ../src/model/plane.cpp \
+ ../src/model/sphere.cpp \
+ ../src/module/abs.cpp \
+ ../src/module/add.cpp \
+ ../src/module/billow.cpp \
+ ../src/module/blend.cpp \
+ ../src/module/cache.cpp \
+ ../src/module/checkerboard.cpp \
+ ../src/module/clamp.cpp \
+ ../src/module/const.cpp \
+ ../src/module/curve.cpp \
+ ../src/module/cylinders.cpp \
+ ../src/module/displace.cpp \
+ ../src/module/exponent.cpp \
+ ../src/module/invert.cpp \
+ ../src/module/max.cpp \
+ ../src/module/min.cpp \
+ ../src/module/modulebase.cpp \
+ ../src/module/multiply.cpp \
+ ../src/module/perlin.cpp \
+ ../src/module/power.cpp \
+ ../src/module/ridgedmulti.cpp \
+ ../src/module/rotatepoint.cpp \
+ ../src/module/scalebias.cpp \
+ ../src/module/scalepoint.cpp \
+ ../src/module/select.cpp \
+ ../src/module/spheres.cpp \
+ ../src/module/terrace.cpp \
+ ../src/module/translatepoint.cpp \
+ ../src/module/turbulence.cpp \
+ ../src/module/voronoi.cpp
+
+HEADERS=../src/basictypes.h \
+ ../src/exception.h \
+ ../src/interp.h \
+ ../src/latlon.h \
+ ../src/mathconsts.h \
+ ../src/misc.h \
+ ../src/noisegen.h \
+ ../src/noise.h \
+ ../src/vectortable.h \
+ ../src/model/cylinder.h \
+ ../src/model/model.h \
+ ../src/model/sphere.h \
+ ../src/model/line.h \
+ ../src/model/plane.h \
+ ../src/module/abs.h \
+ ../src/module/add.h \
+ ../src/module/billow.h \
+ ../src/module/blend.h \
+ ../src/module/cache.h \
+ ../src/module/checkerboard.h \
+ ../src/module/clamp.h \
+ ../src/module/const.h \
+ ../src/module/curve.h \
+ ../src/module/cylinders.h \
+ ../src/module/displace.h \
+ ../src/module/exponent.h \
+ ../src/module/invert.h \
+ ../src/module/max.h \
+ ../src/module/min.h \
+ ../src/module/module.h \
+ ../src/module/modulebase.h \
+ ../src/module/multiply.h \
+ ../src/module/perlin.h \
+ ../src/module/power.h \
+ ../src/module/ridgedmulti.h \
+ ../src/module/rotatepoint.h \
+ ../src/module/scalebias.h \
+ ../src/module/scalepoint.h \
+ ../src/module/select.h \
+ ../src/module/spheres.h \
+ ../src/module/terrace.h \
+ ../src/module/translatepoint.h \
+ ../src/module/turbulence.h \
+ ../src/module/voronoi.h
Added: trunk/python-ogre/ThirdParty/noise/abs.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/abs.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/abs.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,37 @@
+// abs.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "abs.h"
+
+using namespace noise::module;
+
+Abs::Abs ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Abs::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+
+ return fabs (m_pSourceModule[0]->GetValue (x, y, z));
+}
Added: trunk/python-ogre/ThirdParty/noise/add.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/add.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/add.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,39 @@
+// add.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "add.h"
+
+using namespace noise::module;
+
+Add::Add ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Add::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+ assert (m_pSourceModule[1] != NULL);
+
+ return m_pSourceModule[0]->GetValue (x, y, z)
+ + m_pSourceModule[1]->GetValue (x, y, z);
+}
Added: trunk/python-ogre/ThirdParty/noise/basictypes.h
===================================================================
--- trunk/python-ogre/ThirdParty/noise/basictypes.h (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/basictypes.h 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,60 @@
+// basictypes.h
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#ifndef NOISE_BASICTYPES_H
+#define NOISE_BASICTYPES_H
+
+// You may need to modify these constants for your compiler or platform.
+
+namespace noise
+{
+
+ /// @defgroup libnoise libnoise
+ /// @addtogroup libnoise
+ /// @{
+
+ /// Unsigned integer type.
+ typedef unsigned int uint;
+
+ /// 32-bit unsigned integer type.
+ typedef unsigned int uint32;
+
+ /// 16-bit unsigned integer type.
+ typedef unsigned short uint16;
+
+ /// 8-bit unsigned integer type.
+ typedef unsigned char uint8;
+
+ /// 32-bit signed integer type.
+ typedef int int32;
+
+ /// 16-bit signed integer type.
+ typedef short int16;
+
+ /// 8-bit signed integer type.
+ typedef char int8;
+
+ /// @}
+
+}
+
+#endif
Added: trunk/python-ogre/ThirdParty/noise/billow.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/billow.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/billow.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,74 @@
+// billow.cpp
+//
+// Copyright (C) 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "billow.h"
+
+using namespace noise::module;
+
+Billow::Billow ():
+ Module (GetSourceModuleCount ()),
+ m_frequency (DEFAULT_BILLOW_FREQUENCY ),
+ m_lacunarity (DEFAULT_BILLOW_LACUNARITY ),
+ m_noiseQuality (DEFAULT_BILLOW_QUALITY ),
+ m_octaveCount (DEFAULT_BILLOW_OCTAVE_COUNT),
+ m_persistence (DEFAULT_BILLOW_PERSISTENCE ),
+ m_seed (DEFAULT_BILLOW_SEED)
+{
+}
+
+double Billow::GetValue (double x, double y, double z) const
+{
+ double value = 0.0;
+ double signal = 0.0;
+ double curPersistence = 1.0;
+ double nx, ny, nz;
+ int seed;
+
+ x *= m_frequency;
+ y *= m_frequency;
+ z *= m_frequency;
+
+ for (int curOctave = 0; curOctave < m_octaveCount; curOctave++) {
+
+ // Make sure that these floating-point values have the same range as a 32-
+ // bit integer so that we can pass them to the coherent-noise functions.
+ nx = MakeInt32Range (x);
+ ny = MakeInt32Range (y);
+ nz = MakeInt32Range (z);
+
+ // Get the coherent-noise value from the input value and add it to the
+ // final result.
+ seed = (m_seed + curOctave) & 0xffffffff;
+ signal = GradientCoherentNoise3D (nx, ny, nz, seed, m_noiseQuality);
+ signal = 2.0 * fabs (signal) - 1.0;
+ value += signal * curPersistence;
+
+ // Prepare the next octave.
+ x *= m_lacunarity;
+ y *= m_lacunarity;
+ z *= m_lacunarity;
+ curPersistence *= m_persistence;
+ }
+ value += 0.5;
+
+ return value;
+}
Added: trunk/python-ogre/ThirdParty/noise/blend.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/blend.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/blend.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,43 @@
+// blend.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "blend.h"
+#include "../interp.h"
+
+using namespace noise::module;
+
+Blend::Blend ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Blend::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+ assert (m_pSourceModule[1] != NULL);
+ assert (m_pSourceModule[2] != NULL);
+
+ double v0 = m_pSourceModule[0]->GetValue (x, y, z);
+ double v1 = m_pSourceModule[1]->GetValue (x, y, z);
+ double alpha = (m_pSourceModule[2]->GetValue (x, y, z) + 1.0) / 2.0;
+ return LinearInterp (v0, v1, alpha);
+}
Added: trunk/python-ogre/ThirdParty/noise/cache.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/cache.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/cache.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,45 @@
+// cache.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "cache.h"
+
+using namespace noise::module;
+
+Cache::Cache ():
+ Module (GetSourceModuleCount ()),
+ m_isCached (false)
+{
+}
+
+double Cache::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+
+ if (!(m_isCached && x == m_xCache && y == m_yCache && z == m_zCache)) {
+ m_cachedValue = m_pSourceModule[0]->GetValue (x, y, z);
+ m_xCache = x;
+ m_yCache = y;
+ m_zCache = z;
+ }
+ m_isCached = true;
+ return m_cachedValue;
+}
Added: trunk/python-ogre/ThirdParty/noise/checkerboard.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/checkerboard.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/checkerboard.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,38 @@
+// checkerboard.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "checkerboard.h"
+
+using namespace noise::module;
+
+Checkerboard::Checkerboard ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Checkerboard::GetValue (double x, double y, double z) const
+{
+ int ix = (int)(floor (MakeInt32Range (x)));
+ int iy = (int)(floor (MakeInt32Range (y)));
+ int iz = (int)(floor (MakeInt32Range (z)));
+ return (ix & 1 ^ iy & 1 ^ iz & 1)? -1.0: 1.0;
+}
Added: trunk/python-ogre/ThirdParty/noise/clamp.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/clamp.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/clamp.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,54 @@
+// clamp.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "clamp.h"
+
+using namespace noise::module;
+
+Clamp::Clamp ():
+ Module (GetSourceModuleCount ()),
+ m_lowerBound (DEFAULT_CLAMP_LOWER_BOUND),
+ m_upperBound (DEFAULT_CLAMP_UPPER_BOUND)
+{
+}
+
+double Clamp::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+
+ double value = m_pSourceModule[0]->GetValue (x, y, z);
+ if (value < m_lowerBound) {
+ return m_lowerBound;
+ } else if (value > m_upperBound) {
+ return m_upperBound;
+ } else {
+ return value;
+ }
+}
+
+void Clamp::SetBounds (double lowerBound, double upperBound)
+{
+ assert (lowerBound < upperBound);
+
+ m_lowerBound = lowerBound;
+ m_upperBound = upperBound;
+}
Added: trunk/python-ogre/ThirdParty/noise/const.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/const.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/const.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,31 @@
+// const.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "const.h"
+
+using namespace noise::module;
+
+Const::Const ():
+ Module (GetSourceModuleCount ()),
+ m_constValue (DEFAULT_CONST_VALUE)
+{
+}
Added: trunk/python-ogre/ThirdParty/noise/curve.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/curve.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/curve.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,143 @@
+// curve.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "../interp.h"
+#include "../misc.h"
+#include "curve.h"
+
+using namespace noise::module;
+
+Curve::Curve ():
+ Module (GetSourceModuleCount ()),
+ m_pControlPoints (NULL)
+{
+ m_controlPointCount = 0;
+}
+
+Curve::~Curve ()
+{
+ delete[] m_pControlPoints;
+}
+
+void Curve::AddControlPoint (double inputValue, double outputValue)
+{
+ // Find the insertion point for the new control point and insert the new
+ // point at that position. The control point array will remain sorted by
+ // input value.
+ int insertionPos = FindInsertionPos (inputValue);
+ InsertAtPos (insertionPos, inputValue, outputValue);
+}
+
+void Curve::ClearAllControlPoints ()
+{
+ delete[] m_pControlPoints;
+ m_pControlPoints = NULL;
+ m_controlPointCount = 0;
+}
+
+int Curve::FindInsertionPos (double inputValue)
+{
+ int insertionPos;
+ for (insertionPos = 0; insertionPos < m_controlPointCount; insertionPos++) {
+ if (inputValue < m_pControlPoints[insertionPos].inputValue) {
+ // We found the array index in which to insert the new control point.
+ // Exit now.
+ break;
+ } else if (inputValue == m_pControlPoints[insertionPos].inputValue) {
+ // Each control point is required to contain a unique input value, so
+ // throw an exception.
+ throw noise::ExceptionInvalidParam ();
+ }
+ }
+ return insertionPos;
+}
+
+double Curve::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+ assert (m_controlPointCount >= 4);
+
+ // Get the output value from the source module.
+ double sourceModuleValue = m_pSourceModule[0]->GetValue (x, y, z);
+
+ // Find the first element in the control point array that has an input value
+ // larger than the output value from the source module.
+ int indexPos;
+ for (indexPos = 0; indexPos < m_controlPointCount; indexPos++) {
+ if (sourceModuleValue < m_pControlPoints[indexPos].inputValue) {
+ break;
+ }
+ }
+
+ // Find the four nearest control points so that we can perform cubic
+ // interpolation.
+ int index0 = ClampValue (indexPos - 2, 0, m_controlPointCount - 1);
+ int index1 = ClampValue (indexPos - 1, 0, m_controlPointCount - 1);
+ int index2 = ClampValue (indexPos , 0, m_controlPointCount - 1);
+ int index3 = ClampValue (indexPos + 1, 0, m_controlPointCount - 1);
+
+ // If some control points are missing (which occurs if the value from the
+ // source module is greater than the largest input value or less than the
+ // smallest input value of the control point array), get the corresponding
+ // output value of the nearest control point and exit now.
+ if (index1 == index2) {
+ return m_pControlPoints[index1].outputValue;
+ }
+
+ // Compute the alpha value used for cubic interpolation.
+ double input0 = m_pControlPoints[index1].inputValue;
+ double input1 = m_pControlPoints[index2].inputValue;
+ double alpha = (sourceModuleValue - input0) / (input1 - input0);
+
+ // Now perform the cubic interpolation given the alpha value.
+ return CubicInterp (
+ m_pControlPoints[index0].outputValue,
+ m_pControlPoints[index1].outputValue,
+ m_pControlPoints[index2].outputValue,
+ m_pControlPoints[index3].outputValue,
+ alpha);
+}
+
+void Curve::InsertAtPos (int insertionPos, double inputValue,
+ double outputValue)
+{
+ // Make room for the new control point at the specified position within the
+ // control point array. The position is determined by the input value of
+ // the control point; the control points must be sorted by input value
+ // within that array.
+ ControlPoint* newControlPoints = new ControlPoint[m_controlPointCount + 1];
+ for (int i = 0; i < m_controlPointCount; i++) {
+ if (i < insertionPos) {
+ newControlPoints[i] = m_pControlPoints[i];
+ } else {
+ newControlPoints[i + 1] = m_pControlPoints[i];
+ }
+ }
+ delete[] m_pControlPoints;
+ m_pControlPoints = newControlPoints;
+ ++m_controlPointCount;
+
+ // Now that we've made room for the new control point within the array, add
+ // the new control point.
+ m_pControlPoints[insertionPos].inputValue = inputValue ;
+ m_pControlPoints[insertionPos].outputValue = outputValue;
+}
Added: trunk/python-ogre/ThirdParty/noise/cylinder.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/cylinder.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/cylinder.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,47 @@
+// cylinder.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "../mathconsts.h"
+#include "cylinder.h"
+
+using namespace noise;
+using namespace noise::model;
+
+Cylinder::Cylinder (): m_pModule (NULL)
+{
+}
+
+Cylinder::Cylinder (const module::Module& module):
+ m_pModule (&module)
+{
+}
+
+double Cylinder::GetValue (double angle, double height) const
+{
+ assert (m_pModule != NULL);
+
+ double x, y, z;
+ x = cos (angle * DEG_TO_RAD);
+ y = height;
+ z = sin (angle * DEG_TO_RAD);
+ return m_pModule->GetValue (x, y, z);
+}
Added: trunk/python-ogre/ThirdParty/noise/cylinders.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/cylinders.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/cylinders.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,44 @@
+// cylinders.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "../misc.h"
+#include "cylinders.h"
+
+using namespace noise::module;
+
+Cylinders::Cylinders ():
+ Module (GetSourceModuleCount ()),
+ m_frequency (DEFAULT_CYLINDERS_FREQUENCY)
+{
+}
+
+double Cylinders::GetValue (double x, double y, double z) const
+{
+ x *= m_frequency;
+ z *= m_frequency;
+
+ double distFromCenter = sqrt (x * x + z * z);
+ double distFromSmallerSphere = distFromCenter - floor (distFromCenter);
+ double distFromLargerSphere = 1.0 - distFromSmallerSphere;
+ double nearestDist = GetMin (distFromSmallerSphere, distFromLargerSphere);
+ return 1.0 - (nearestDist * 4.0); // Puts it in the -1.0 to +1.0 range.
+}
Added: trunk/python-ogre/ThirdParty/noise/displace.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/displace.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/displace.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,48 @@
+// displace.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "displace.h"
+
+using namespace noise::module;
+
+Displace::Displace ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Displace::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+ assert (m_pSourceModule[1] != NULL);
+ assert (m_pSourceModule[2] != NULL);
+ assert (m_pSourceModule[3] != NULL);
+
+ // Get the output values from the three displacement modules. Add each
+ // value to the corresponding coordinate in the input value.
+ double xDisplace = x + (m_pSourceModule[1]->GetValue (x, y, z));
+ double yDisplace = y + (m_pSourceModule[2]->GetValue (x, y, z));
+ double zDisplace = z + (m_pSourceModule[3]->GetValue (x, y, z));
+
+ // Retrieve the output value using the offsetted input value instead of
+ // the original input value.
+ return m_pSourceModule[0]->GetValue (xDisplace, yDisplace, zDisplace);
+}
Added: trunk/python-ogre/ThirdParty/noise/exception.h
===================================================================
--- trunk/python-ogre/ThirdParty/noise/exception.h (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/exception.h 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,74 @@
+// exception.h
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#ifndef NOISE_EXCEPTION_H
+#define NOISE_EXCEPTION_H
+
+namespace noise
+{
+
+ /// @addtogroup libnoise
+ /// @{
+
+ /// Abstract base class for libnoise exceptions
+ class Exception
+ {
+ };
+
+ /// Invalid parameter exception
+ ///
+ /// An invalid parameter was passed to a libnoise function or method.
+ class ExceptionInvalidParam: public Exception
+ {
+ };
+
+ /// No module exception
+ ///
+ /// Could not retrieve a source module from a noise module.
+ ///
+ /// @note If one or more required source modules were not connected to a
+ /// specific noise module, and its GetValue() method was called, that
+ /// method will raise a debug assertion instead of this exception. This
+ /// is done for performance reasons.
+ class ExceptionNoModule: public Exception
+ {
+ };
+
+ /// Out of memory exception
+ ///
+ /// There was not enough memory to perform an action.
+ class ExceptionOutOfMemory: public Exception
+ {
+ };
+
+ /// Unknown exception
+ ///
+ /// libnoise raised an unknown exception.
+ class ExceptionUnknown: public Exception
+ {
+ };
+
+ /// @}
+
+}
+
+#endif
Added: trunk/python-ogre/ThirdParty/noise/exponent.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/exponent.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/exponent.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,39 @@
+// exponent.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "exponent.h"
+
+using namespace noise::module;
+
+Exponent::Exponent ():
+ Module (GetSourceModuleCount ()),
+ m_exponent (DEFAULT_EXPONENT)
+{
+}
+
+double Exponent::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+
+ double value = m_pSourceModule[0]->GetValue (x, y, z);
+ return (pow (fabs ((value + 1.0) / 2.0), m_exponent) * 2.0 - 1.0);
+}
Added: trunk/python-ogre/ThirdParty/noise/interp.h
===================================================================
--- trunk/python-ogre/ThirdParty/noise/interp.h (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/interp.h 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,112 @@
+// interp.h
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#ifndef NOISE_INTERP_H
+#define NOISE_INTERP_H
+
+namespace noise
+{
+
+ /// @addtogroup libnoise
+ /// @{
+
+ /// Performs cubic interpolation between two values bound between two other
+ /// values.
+ ///
+ /// @param n0 The value before the first value.
+ /// @param n1 The first value.
+ /// @param n2 The second value.
+ /// @param n3 The value after the second value.
+ /// @param a The alpha value.
+ ///
+ /// @returns The interpolated value.
+ ///
+ /// The alpha value should range from 0.0 to 1.0. If the alpha value is
+ /// 0.0, this function returns @a n1. If the alpha value is 1.0, this
+ /// function returns @a n2.
+ inline double CubicInterp (double n0, double n1, double n2, double n3,
+ double a)
+ {
+ double p = (n3 - n2) - (n0 - n1);
+ double q = (n0 - n1) - p;
+ double r = n2 - n0;
+ double s = n1;
+ return p * a * a * a + q * a * a + r * a + s;
+ }
+
+ /// Performs linear interpolation between two values.
+ ///
+ /// @param n0 The first value.
+ /// @param n1 The second value.
+ /// @param a The alpha value.
+ ///
+ /// @returns The interpolated value.
+ ///
+ /// The alpha value should range from 0.0 to 1.0. If the alpha value is
+ /// 0.0, this function returns @a n0. If the alpha value is 1.0, this
+ /// function returns @a n1.
+ inline double LinearInterp (double n0, double n1, double a)
+ {
+ return ((1.0 - a) * n0) + (a * n1);
+ }
+
+ /// Maps a value onto a cubic S-curve.
+ ///
+ /// @param a The value to map onto a cubic S-curve.
+ ///
+ /// @returns The mapped value.
+ ///
+ /// @a a should range from 0.0 to 1.0.
+ ///
+ /// The derivitive of a cubic S-curve is zero at @a a = 0.0 and @a a =
+ /// 1.0
+ inline double SCurve3 (double a)
+ {
+ return (a * a * (3.0 - 2.0 * a));
+ }
+
+ /// Maps a value onto a quintic S-curve.
+ ///
+ /// @param a The value to map onto a quintic S-curve.
+ ///
+ /// @returns The mapped value.
+ ///
+ /// @a a should range from 0.0 to 1.0.
+ ///
+ /// The first derivitive of a quintic S-curve is zero at @a a = 0.0 and
+ /// @a a = 1.0
+ ///
+ /// The second derivitive of a quintic S-curve is zero at @a a = 0.0 and
+ /// @a a = 1.0
+ inline double SCurve5 (double a)
+ {
+ double a3 = a * a * a;
+ double a4 = a3 * a;
+ double a5 = a4 * a;
+ return (6.0 * a5) - (15.0 * a4) + (10.0 * a3);
+ }
+
+ // @}
+
+}
+
+#endif
Added: trunk/python-ogre/ThirdParty/noise/invert.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/invert.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/invert.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,37 @@
+// invert.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "invert.h"
+
+using namespace noise::module;
+
+Invert::Invert ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Invert::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+
+ return -(m_pSourceModule[0]->GetValue (x, y, z));
+}
Added: trunk/python-ogre/ThirdParty/noise/latlon.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/latlon.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/latlon.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,34 @@
+// latlon.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "latlon.h"
+
+using namespace noise;
+
+void noise::LatLonToXYZ (double lat, double lon, double& x, double& y,
+ double& z)
+{
+ double r = cos (DEG_TO_RAD * lat);
+ x = r * cos (DEG_TO_RAD * lon);
+ y = sin (DEG_TO_RAD * lat);
+ z = r * sin (DEG_TO_RAD * lon);
+}
Added: trunk/python-ogre/ThirdParty/noise/latlon.h
===================================================================
--- trunk/python-ogre/ThirdParty/noise/latlon.h (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/latlon.h 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,52 @@
+// latlon.h
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#ifndef NOISE_LATLON_H
+#define NOISE_LATLON_H
+
+#include <math.h>
+#include "mathconsts.h"
+
+namespace noise
+{
+
+ /// @addtogroup libnoise
+ /// @{
+
+ /// Converts latitude/longitude coordinates on a unit sphere into 3D
+ /// Cartesian coordinates.
+ ///
+ /// @param lat The latitude, in degrees.
+ /// @param lon The longitude, in degrees.
+ /// @param x On exit, this parameter contains the @a x coordinate.
+ /// @param y On exit, this parameter contains the @a y coordinate.
+ /// @param z On exit, this parameter contains the @a z coordinate.
+ ///
+ /// @pre lat must range from @b -90 to @b +90.
+ /// @pre lon must range from @b -180 to @b +180.
+ void LatLonToXYZ (double lat, double lon, double& x, double& y, double& z);
+
+ /// @}
+
+}
+
+#endif
Added: trunk/python-ogre/ThirdParty/noise/line.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/line.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/line.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,65 @@
+// line.cpp
+//
+// Copyright (C) 2004 Keith Davies
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+
+#include "line.h"
+
+using namespace noise;
+using namespace noise::model;
+
+Line::Line ():
+
+ m_attenuate (true),
+ m_pModule (NULL),
+ m_x0 (0.0),
+ m_x1 (1.0),
+ m_y0 (0.0),
+ m_y1 (1.0),
+ m_z0 (0.0),
+ m_z1 (1.0)
+{
+}
+
+Line::Line (const module::Module& module):
+
+ m_attenuate (true),
+ m_pModule (&module),
+ m_x0 (0.0),
+ m_x1 (1.0),
+ m_y0 (0.0),
+ m_y1 (1.0),
+ m_z0 (0.0),
+ m_z1 (1.0)
+{
+}
+
+double Line::GetValue (double p) const
+{
+ assert (m_pModule != NULL);
+
+ double x = (m_x1 - m_x0) * p + m_x0;
+ double y = (m_y1 - m_y0) * p + m_y0;
+ double z = (m_z1 - m_z0) * p + m_z0;
+ double value = m_pModule->GetValue (x, y, z);
+
+ if (m_attenuate) {
+ return p * (1.0 - p) * 4 * value;
+ } else {
+ return value;
+ }
+}
Added: trunk/python-ogre/ThirdParty/noise/mathconsts.h
===================================================================
--- trunk/python-ogre/ThirdParty/noise/mathconsts.h (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/mathconsts.h 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,54 @@
+// mathconsts.h
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#ifndef NOISE_MATHCONSTS_H
+#define NOISE_MATHCONSTS_H
+
+// For whatever reason, I can't find the basic math consts in the MSVC version
+// of math.h.
+
+namespace noise
+{
+
+ /// @addtogroup libnoise
+ /// @{
+
+ /// Pi.
+ const double PI = 3.1415926535897932385;
+
+ /// Square root of 2.
+ const double SQRT_2 = 1.4142135623730950488;
+
+ /// Square root of 3.
+ const double SQRT_3 = 1.7320508075688772935;
+
+ /// Converts an angle from degrees to radians.
+ const double DEG_TO_RAD = PI / 180.0;
+
+ /// Converts an angle from radians to degrees.
+ const double RAD_TO_DEG = 1.0 / DEG_TO_RAD;
+
+ /// @}
+
+}
+
+#endif
Added: trunk/python-ogre/ThirdParty/noise/max.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/max.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/max.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,41 @@
+// max.cpp
+//
+// Copyright (C) 2003, 2004 Jason Bevins
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License (COPYING.txt) for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The developer's email is jlb...@gm... (for great email, take
+// off every 'zig'.)
+//
+
+#include "../misc.h"
+#include "max.h"
+
+using namespace noise::module;
+
+Max::Max ():
+ Module (GetSourceModuleCount ())
+{
+}
+
+double Max::GetValue (double x, double y, double z) const
+{
+ assert (m_pSourceModule[0] != NULL);
+ assert (m_pSourceModule[1] != NULL);
+
+ double v0 = m_pSourceModule[0]->GetValue (x, y, z);
+ double v1 = m_pSourceModule[1]->GetValue (x, y, z);
+ return GetMax (v0, v1);
+}
Added: trunk/python-ogre/ThirdParty/noise/min.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/noise/min.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/noise/min.cpp 2007-10-25 05:38:36 UTC (rev 462)
@@ -0,0 +1,41 @@
+...
[truncated message content] |