Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-10-29 05:09:12 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-10-29 05:09:12 +0400
commit15ed8343437c6b304de72cd14591455da1d5b3ec (patch)
treecbe40f76668f5e8539744c4d2f8aeaa0ded72f52 /intern
parent5acd5d14970c829c2873623716a67beeb6da5278 (diff)
parentdd106b5c7a129e00bebe121c4da8cb90a16d48cb (diff)
Merged changes in the trunk up to revision 51718.
Conflicts resolved: source/blender/blenloader/intern/readfile.c source/blender/makesrna/intern/rna_scene.c release/datafiles/startup.blend
Diffstat (limited to 'intern')
-rw-r--r--intern/CMakeLists.txt5
-rw-r--r--intern/SConscript5
-rw-r--r--intern/audaspace/CMakeLists.txt2
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.cpp288
-rw-r--r--intern/audaspace/intern/AUD_AnimateableProperty.cpp14
-rw-r--r--intern/audaspace/intern/AUD_AnimateableProperty.h7
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp6
-rw-r--r--intern/audaspace/intern/AUD_ChannelMapperReader.cpp50
-rw-r--r--intern/audaspace/intern/AUD_IDevice.h3
-rw-r--r--intern/audaspace/intern/AUD_ILockable.h21
-rw-r--r--intern/audaspace/intern/AUD_MutexLock.h24
-rw-r--r--intern/audaspace/intern/AUD_SequencerEntry.cpp53
-rw-r--r--intern/audaspace/intern/AUD_SequencerEntry.h7
-rw-r--r--intern/audaspace/intern/AUD_SequencerFactory.cpp33
-rw-r--r--intern/audaspace/intern/AUD_SequencerFactory.h7
-rw-r--r--intern/audaspace/intern/AUD_SequencerHandle.cpp8
-rw-r--r--intern/audaspace/intern/AUD_SequencerReader.cpp5
-rw-r--r--intern/audaspace/intern/AUD_SoftwareDevice.cpp58
-rw-r--r--intern/container/CMakeLists.txt7
-rw-r--r--intern/container/CTR_HashedPtr.h23
-rw-r--r--intern/container/CTR_List.h112
-rw-r--r--intern/container/CTR_Map.h84
-rw-r--r--intern/container/CTR_TaggedIndex.h15
-rw-r--r--intern/container/CTR_TaggedSetOps.h61
-rw-r--r--intern/container/CTR_UHeap.h307
-rw-r--r--intern/container/intern/CTR_List.cpp127
-rw-r--r--intern/cycles/blender/addon/properties.py6
-rw-r--r--intern/cycles/blender/addon/ui.py5
-rw-r--r--intern/cycles/blender/blender_camera.cpp8
-rw-r--r--intern/cycles/blender/blender_session.cpp25
-rw-r--r--intern/cycles/blender/blender_shader.cpp33
-rw-r--r--intern/cycles/blender/blender_sync.cpp10
-rw-r--r--intern/cycles/blender/blender_util.h44
-rw-r--r--intern/cycles/bvh/bvh_node.h2
-rw-r--r--intern/cycles/device/device.cpp14
-rw-r--r--intern/cycles/kernel/CMakeLists.txt12
-rw-r--r--intern/cycles/kernel/kernel_bvh.h5
-rw-r--r--intern/cycles/kernel/kernel_types.h10
-rw-r--r--intern/cycles/kernel/osl/nodes/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/osl/nodes/node_bump.osl19
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_point.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_image_texture.osl92
-rw-r--r--intern/cycles/kernel/osl/nodes/node_light_falloff.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_mapping.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_set_normal.osl (renamed from intern/decimation/intern/LOD_MeshException.h)45
-rw-r--r--intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl31
-rw-r--r--intern/cycles/kernel/osl/osl_closures.h2
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp49
-rw-r--r--intern/cycles/kernel/svm/svm_image.h2
-rw-r--r--intern/cycles/render/nodes.cpp16
-rw-r--r--intern/cycles/render/osl.cpp20
-rw-r--r--intern/cycles/render/session.cpp36
-rw-r--r--intern/cycles/render/session.h8
-rw-r--r--intern/cycles/render/tile.cpp99
-rw-r--r--intern/cycles/render/tile.h43
-rw-r--r--intern/cycles/subd/subd_build.cpp2
-rw-r--r--intern/cycles/util/util_task.h1
-rw-r--r--intern/decimation/CMakeLists.txt63
-rw-r--r--intern/decimation/SConscript8
-rw-r--r--intern/decimation/extern/LOD_decimation.h117
-rw-r--r--intern/decimation/intern/LOD_DecimationClass.h118
-rw-r--r--intern/decimation/intern/LOD_EdgeCollapser.cpp410
-rw-r--r--intern/decimation/intern/LOD_EdgeCollapser.h117
-rw-r--r--intern/decimation/intern/LOD_ExternBufferEditor.h164
-rw-r--r--intern/decimation/intern/LOD_ExternNormalEditor.cpp264
-rw-r--r--intern/decimation/intern/LOD_ExternNormalEditor.h135
-rw-r--r--intern/decimation/intern/LOD_FaceNormalEditor.cpp291
-rw-r--r--intern/decimation/intern/LOD_FaceNormalEditor.h144
-rw-r--r--intern/decimation/intern/LOD_ManMesh2.cpp618
-rw-r--r--intern/decimation/intern/LOD_ManMesh2.h265
-rw-r--r--intern/decimation/intern/LOD_MeshBounds.h133
-rw-r--r--intern/decimation/intern/LOD_MeshPrimitives.cpp404
-rw-r--r--intern/decimation/intern/LOD_MeshPrimitives.h221
-rw-r--r--intern/decimation/intern/LOD_QSDecimator.cpp327
-rw-r--r--intern/decimation/intern/LOD_QSDecimator.h129
-rw-r--r--intern/decimation/intern/LOD_Quadric.h167
-rw-r--r--intern/decimation/intern/LOD_QuadricEditor.cpp279
-rw-r--r--intern/decimation/intern/LOD_QuadricEditor.h120
-rw-r--r--intern/decimation/intern/LOD_decimation.cpp155
-rw-r--r--intern/elbeem/intern/ntl_geometryshader.h2
-rw-r--r--intern/ghost/GHOST_IEventConsumer.h13
-rw-r--r--intern/ghost/GHOST_ISystem.h108
-rw-r--r--intern/ghost/GHOST_IWindow.h94
-rw-r--r--intern/ghost/GHOST_Rect.h66
-rw-r--r--intern/ghost/GHOST_Types.h2
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCocoa.mm2
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.cpp6
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h14
-rw-r--r--intern/ghost/intern/GHOST_Rect.cpp2
-rw-r--r--intern/ghost/intern/GHOST_System.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp2
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm56
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp6
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm8
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
-rw-r--r--intern/ghost/test/multitest/EventToBuf.c18
-rw-r--r--intern/itasc/Scene.cpp2
-rw-r--r--intern/memutil/MEM_CacheLimiterC-Api.h4
-rw-r--r--intern/memutil/intern/MEM_CacheLimiterC-Api.cpp12
-rw-r--r--intern/opennl/SConscript5
-rw-r--r--intern/raskter/raskter.c2
-rw-r--r--intern/smoke/intern/smoke_API.cpp19
-rw-r--r--intern/smoke/intern/spectrum.cpp2
-rw-r--r--intern/smoke/intern/spectrum.h2
107 files changed, 1106 insertions, 5984 deletions
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 2551df6ba76..cb2fc239859 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -49,11 +49,6 @@ if(WITH_MOD_SMOKE)
add_subdirectory(smoke)
endif()
-if(WITH_MOD_DECIMATE)
- add_subdirectory(container)
- add_subdirectory(decimation)
-endif()
-
if(WITH_MOD_BOOLEAN)
add_subdirectory(bsp)
endif()
diff --git a/intern/SConscript b/intern/SConscript
index 3e40ef38705..59e412333b0 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -6,9 +6,7 @@ SConscript(['audaspace/SConscript',
'ghost/SConscript',
'guardedalloc/SConscript',
'moto/SConscript',
- 'container/SConscript',
'memutil/SConscript/',
- 'decimation/SConscript',
'iksolver/SConscript',
'itasc/SConscript',
'opencolorio/SConscript',
@@ -17,6 +15,9 @@ SConscript(['audaspace/SConscript',
'smoke/SConscript',
'raskter/SConscript'])
+# currently only contains headers
+# SConscript('container/SConscript')
+
if env ['WITH_BF_REMESH']:
SConscript(['dualcon/SConscript'])
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index dc4ca7903cd..1671194653a 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -94,6 +94,7 @@ set(SRC
intern/AUD_IDevice.h
intern/AUD_IFactory.h
intern/AUD_IHandle.h
+ intern/AUD_ILockable.h
intern/AUD_IReader.h
intern/AUD_IWriter.h
intern/AUD_JOSResampleFactory.cpp
@@ -108,6 +109,7 @@ set(SRC
intern/AUD_Mixer.h
intern/AUD_MixerFactory.cpp
intern/AUD_MixerFactory.h
+ intern/AUD_MutexLock.h
intern/AUD_NULLDevice.cpp
intern/AUD_NULLDevice.h
intern/AUD_PyInit.h
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index f68d41f6a1c..12b6d2e4f38 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -31,6 +31,7 @@
#include "AUD_IFactory.h"
#include "AUD_IReader.h"
#include "AUD_ConverterReader.h"
+#include "AUD_MutexLock.h"
#include <cstring>
#include <limits>
@@ -125,7 +126,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::pause()
{
if(m_status)
{
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
if(m_status == AUD_STATUS_PLAYING)
{
@@ -135,12 +136,9 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::pause()
alSourcePause(m_source);
m_status = AUD_STATUS_PAUSED;
- m_device->unlock();
return true;
}
-
- m_device->unlock();
}
return false;
@@ -150,7 +148,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::resume()
{
if(m_status)
{
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
if(m_status == AUD_STATUS_PAUSED)
{
@@ -159,11 +157,8 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::resume()
m_device->start();
m_status = AUD_STATUS_PLAYING;
- m_device->unlock();
return true;
}
-
- m_device->unlock();
}
return false;
@@ -174,7 +169,10 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::stop()
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
// AUD_XXX Create a reference of our own object so that it doesn't get
// deleted before the end of this function
@@ -185,8 +183,6 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::stop()
else
m_device->m_pausedSounds.remove(This);
- m_device->unlock();
-
alDeleteSources(1, &m_source);
if(!m_isBuffered)
alDeleteBuffers(CYCLE_BUFFERS, m_buffers);
@@ -208,11 +204,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setKeep(bool keep)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- m_keep = keep;
+ if(!m_status)
+ return false;
- m_device->unlock();
+ m_keep = keep;
return true;
}
@@ -222,7 +219,10 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
if(m_isBuffered)
alSourcef(m_source, AL_SEC_OFFSET, position);
@@ -272,17 +272,18 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
}
}
- m_device->unlock();
-
return true;
}
float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
{
if(!m_status)
- return 0.0f;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return 0.0f;
float position = 0.0f;
@@ -295,8 +296,6 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
CYCLE_BUFFERS) / (float)specs.rate;
}
- m_device->unlock();
-
return position;
}
@@ -310,13 +309,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolume()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_GAIN, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_GAIN, &result);
return result;
}
@@ -326,11 +326,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolume(float volume)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_GAIN, volume);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_GAIN, volume);
return true;
}
@@ -340,13 +341,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPitch()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_PITCH, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_PITCH, &result);
return result;
}
@@ -356,11 +358,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setPitch(float pitch)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_PITCH, pitch);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_PITCH, pitch);
return true;
}
@@ -385,13 +388,14 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setStopCallback(stopCallback callback,
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
m_stop = callback;
m_stop_data = data;
- m_device->unlock();
-
return true;
}
@@ -404,15 +408,16 @@ AUD_Vector3 AUD_OpenALDevice::AUD_OpenALHandle::getSourceLocation()
AUD_Vector3 result = AUD_Vector3(0, 0, 0);
if(!m_status)
- return result;
+ return false;
+
+ AUD_MutexLock lock(*m_device);
- m_device->lock();
+ if(!m_status)
+ return result;
ALfloat p[3];
alGetSourcefv(m_source, AL_POSITION, p);
- m_device->unlock();
-
result = AUD_Vector3(p[0], p[1], p[2]);
return result;
@@ -423,11 +428,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceLocation(const AUD_Vector3& lo
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcefv(m_source, AL_POSITION, (ALfloat*)location.get());
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcefv(m_source, AL_POSITION, (ALfloat*)location.get());
return true;
}
@@ -437,15 +443,16 @@ AUD_Vector3 AUD_OpenALDevice::AUD_OpenALHandle::getSourceVelocity()
AUD_Vector3 result = AUD_Vector3(0, 0, 0);
if(!m_status)
- return result;
+ return false;
+
+ AUD_MutexLock lock(*m_device);
- m_device->lock();
+ if(!m_status)
+ return result;
ALfloat v[3];
alGetSourcefv(m_source, AL_VELOCITY, v);
- m_device->unlock();
-
result = AUD_Vector3(v[0], v[1], v[2]);
return result;
@@ -456,11 +463,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceVelocity(const AUD_Vector3& ve
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcefv(m_source, AL_VELOCITY, (ALfloat*)velocity.get());
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcefv(m_source, AL_VELOCITY, (ALfloat*)velocity.get());
return true;
}
@@ -472,9 +480,6 @@ AUD_Quaternion AUD_OpenALDevice::AUD_OpenALHandle::getSourceOrientation()
bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaternion& orientation)
{
- if(!m_status)
- return false;
-
ALfloat direction[3];
direction[0] = -2 * (orientation.w() * orientation.y() +
orientation.x() * orientation.z());
@@ -482,11 +487,16 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaterni
orientation.z() * orientation.y());
direction[2] = 2 * (orientation.x() * orientation.x() +
orientation.y() * orientation.y()) - 1;
- m_device->lock();
- alSourcefv(m_source, AL_DIRECTION, direction);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
+
+ alSourcefv(m_source, AL_DIRECTION, direction);
m_orientation = orientation;
@@ -500,11 +510,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::isRelative()
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcei(m_source, AL_SOURCE_RELATIVE, &result);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alGetSourcei(m_source, AL_SOURCE_RELATIVE, &result);
return result;
}
@@ -514,11 +525,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setRelative(bool relative)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcei(m_source, AL_SOURCE_RELATIVE, relative);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcei(m_source, AL_SOURCE_RELATIVE, relative);
return true;
}
@@ -528,13 +540,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolumeMaximum()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_MAX_GAIN, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_MAX_GAIN, &result);
return result;
}
@@ -544,11 +557,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolumeMaximum(float volume)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_MAX_GAIN, volume);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_MAX_GAIN, volume);
return true;
}
@@ -558,13 +572,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getVolumeMinimum()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_MIN_GAIN, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_MIN_GAIN, &result);
return result;
}
@@ -574,11 +589,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setVolumeMinimum(float volume)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_MIN_GAIN, volume);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_MIN_GAIN, volume);
return true;
}
@@ -588,13 +604,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getDistanceMaximum()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_MAX_DISTANCE, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_MAX_DISTANCE, &result);
return result;
}
@@ -604,11 +621,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setDistanceMaximum(float distance)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_MAX_DISTANCE, distance);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_MAX_DISTANCE, distance);
return true;
}
@@ -618,13 +636,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getDistanceReference()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_REFERENCE_DISTANCE, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_REFERENCE_DISTANCE, &result);
return result;
}
@@ -634,11 +653,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setDistanceReference(float distance)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_REFERENCE_DISTANCE, distance);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_REFERENCE_DISTANCE, distance);
return true;
}
@@ -648,13 +668,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getAttenuation()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_ROLLOFF_FACTOR, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_ROLLOFF_FACTOR, &result);
return result;
}
@@ -664,11 +685,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setAttenuation(float factor)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_ROLLOFF_FACTOR, factor);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_ROLLOFF_FACTOR, factor);
return true;
}
@@ -678,13 +700,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeAngleOuter()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_CONE_OUTER_ANGLE, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_CONE_OUTER_ANGLE, &result);
return result;
}
@@ -694,11 +717,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeAngleOuter(float angle)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_CONE_OUTER_ANGLE, angle);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_CONE_OUTER_ANGLE, angle);
return true;
}
@@ -708,13 +732,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeAngleInner()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_CONE_INNER_ANGLE, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_CONE_INNER_ANGLE, &result);
return result;
}
@@ -724,11 +749,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeAngleInner(float angle)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_CONE_INNER_ANGLE, angle);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_CONE_INNER_ANGLE, angle);
return true;
}
@@ -738,13 +764,14 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getConeVolumeOuter()
float result = std::numeric_limits<float>::quiet_NaN();
if(!m_status)
- return result;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alGetSourcef(m_source, AL_CONE_OUTER_GAIN, &result);
+ if(!m_status)
+ return result;
- m_device->unlock();
+ alGetSourcef(m_source, AL_CONE_OUTER_GAIN, &result);
return result;
}
@@ -754,11 +781,12 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setConeVolumeOuter(float volume)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- alSourcef(m_source, AL_CONE_OUTER_GAIN, volume);
+ if(!m_status)
+ return false;
- m_device->unlock();
+ alSourcef(m_source, AL_CONE_OUTER_GAIN, volume);
return true;
}
@@ -776,7 +804,7 @@ static void *AUD_openalRunThread(void *device)
void AUD_OpenALDevice::start(bool join)
{
- lock();
+ AUD_MutexLock lock(*this);
if(!m_playing)
{
@@ -793,8 +821,6 @@ void AUD_OpenALDevice::start(bool join)
m_playing = true;
}
-
- unlock();
}
void AUD_OpenALDevice::updateStreams()
@@ -970,7 +996,6 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
{
// cannot determine how many channels or which format OpenAL uses, but
// it at least is able to play 16 bit stereo audio
- specs.channels = AUD_CHANNELS_STEREO;
specs.format = AUD_FORMAT_S16;
#if 0
@@ -1009,6 +1034,11 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
m_useMC = alIsExtensionPresent("AL_EXT_MCFORMATS") == AL_TRUE;
+ if((!m_useMC && specs.channels > AUD_CHANNELS_STEREO) ||
+ specs.channels == AUD_CHANNELS_STEREO_LFE ||
+ specs.channels == AUD_CHANNELS_SURROUND5)
+ specs.channels = AUD_CHANNELS_STEREO;
+
alGetError();
alcGetError(m_device);
@@ -1177,7 +1207,8 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IReader> rea
if(!getFormat(format, specs))
return AUD_Reference<AUD_IHandle>();
- lock();
+ AUD_MutexLock lock(*this);
+
alcSuspendContext(m_context);
AUD_Reference<AUD_OpenALDevice::AUD_OpenALHandle> sound;
@@ -1190,7 +1221,6 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IReader> rea
catch(AUD_Exception&)
{
alcProcessContext(m_context);
- unlock();
throw;
}
@@ -1201,8 +1231,6 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IReader> rea
start();
- unlock();
-
return AUD_Reference<AUD_IHandle>(sound);
}
@@ -1285,7 +1313,8 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IFactory> fa
void AUD_OpenALDevice::stopAll()
{
- lock();
+ AUD_MutexLock lock(*this);
+
alcSuspendContext(m_context);
while(!m_playingSounds.empty())
@@ -1295,7 +1324,6 @@ void AUD_OpenALDevice::stopAll()
m_pausedSounds.front()->stop();
alcProcessContext(m_context);
- unlock();
}
void AUD_OpenALDevice::lock()
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.cpp b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
index 8a5c538c094..0b333e687ff 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.cpp
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
@@ -28,6 +28,7 @@
#include "AUD_AnimateableProperty.h"
+#include "AUD_MutexLock.h"
#include <cstring>
#include <cmath>
@@ -63,17 +64,15 @@ void AUD_AnimateableProperty::unlock()
void AUD_AnimateableProperty::write(const float* data)
{
- lock();
+ AUD_MutexLock lock(*this);
m_isAnimated = false;
memcpy(getBuffer(), data, m_count * sizeof(float));
-
- unlock();
}
void AUD_AnimateableProperty::write(const float* data, int position, int count)
{
- lock();
+ AUD_MutexLock lock(*this);
m_isAnimated = true;
@@ -87,18 +86,15 @@ void AUD_AnimateableProperty::write(const float* data, int position, int count)
for(int i = pos; i < position; i++)
memcpy(buf + i * m_count, buf + (pos - 1) * m_count, m_count * sizeof(float));
-
- unlock();
}
void AUD_AnimateableProperty::read(float position, float* out)
{
- lock();
+ AUD_MutexLock lock(*this);
if(!m_isAnimated)
{
memcpy(out, getBuffer(), m_count * sizeof(float));
- unlock();
return;
}
@@ -147,8 +143,6 @@ void AUD_AnimateableProperty::read(float position, float* out)
(t3 - 2 * t2 + t) * m0 + (t3 - t2) * m1;
}
}
-
- unlock();
}
bool AUD_AnimateableProperty::isAnimated() const
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.h b/intern/audaspace/intern/AUD_AnimateableProperty.h
index 2f25e330ebd..322748ad571 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.h
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.h
@@ -31,13 +31,14 @@
#define __AUD_ANIMATEABLEPROPERTY_H__
#include "AUD_Buffer.h"
+#include "AUD_ILockable.h"
#include <pthread.h>
/**
* This class saves animation data for float properties.
*/
-class AUD_AnimateableProperty : private AUD_Buffer
+class AUD_AnimateableProperty : private AUD_Buffer, public AUD_ILockable
{
private:
/// The count of floats for a single property.
@@ -68,12 +69,12 @@ public:
/**
* Locks the property.
*/
- void lock();
+ virtual void lock();
/**
* Unlocks the previously locked property.
*/
- void unlock();
+ virtual void unlock();
/**
* Writes the properties value and marks it non-animated.
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 46bba237cff..a1da90b073e 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -68,6 +68,7 @@
#include "AUD_SequencerFactory.h"
#include "AUD_SequencerEntry.h"
#include "AUD_SilenceFactory.h"
+#include "AUD_MutexLock.h"
#ifdef WITH_SDL
#include "AUD_SDLDevice.h"
@@ -858,13 +859,12 @@ AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
AUD_Reference<AUD_IFactory> silence = new AUD_SilenceFactory;
AUD_Reference<AUD_IFactory> limiter = new AUD_LimiterFactory(silence, 0, seconds);
- AUD_device->lock();
+ AUD_MutexLock lock(*AUD_device);
try {
AUD_Handle handle2 = AUD_device->play(limiter);
if (!handle2.isNull()) {
handle2->setStopCallback((stopCallback)pauseSound, handle);
- AUD_device->unlock();
return new AUD_Handle(handle2);
}
}
@@ -872,8 +872,6 @@ AUD_Handle *AUD_pauseAfter(AUD_Handle *handle, float seconds)
{
}
- AUD_device->unlock();
-
return NULL;
}
diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
index 61796098bf7..7a179c6f94a 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
+++ b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp
@@ -67,10 +67,12 @@ void AUD_ChannelMapperReader::setMonoAngle(float angle)
float AUD_ChannelMapperReader::angleDistance(float alpha, float beta)
{
- alpha = fabs(alpha - beta);
+ alpha = beta - alpha;
if(alpha > M_PI)
- alpha = fabs(alpha - 2 * M_PI);
+ alpha -= 2 * M_PI;
+ if(alpha < -M_PI)
+ alpha += 2 * M_PI;
return alpha;
}
@@ -107,8 +109,8 @@ void AUD_ChannelMapperReader::calculateMapping()
if(m_source_channels == AUD_CHANNELS_MONO)
source_angles = &m_mono_angle;
- int channel_min1, channel_min2;
- float angle_min1, angle_min2, angle;
+ int channel_left, channel_right;
+ float angle_left, angle_right, angle;
for(int i = 0; i < m_source_channels; i++)
{
@@ -120,38 +122,46 @@ void AUD_ChannelMapperReader::calculateMapping()
continue;
}
- channel_min1 = channel_min2 = -1;
- angle_min1 = angle_min2 = 2 * M_PI;
+ channel_left = channel_right = -1;
+ angle_left = -2 * M_PI;
+ angle_right = 2 * M_PI;
for(int j = 0; j < m_target_channels; j++)
{
if(j == lfe)
continue;
angle = angleDistance(source_angles[i], target_angles[j]);
- if(angle < angle_min1)
+ if(angle < 0)
{
- channel_min2 = channel_min1;
- angle_min2 = angle_min1;
-
- channel_min1 = j;
- angle_min1 = angle;
+ if(angle > angle_left)
+ {
+ angle_left = angle;
+ channel_left = j;
+ }
}
- else if(angle < angle_min2)
+ else
{
- channel_min2 = j;
- angle_min2 = angle;
+ if(angle < angle_right)
+ {
+ angle_right = angle;
+ channel_right = j;
+ }
}
}
- angle = angle_min1 + angle_min2;
- if(channel_min2 == -1 || angle == 0)
+ angle = angle_right - angle_left;
+ if(channel_right == -1 || angle == 0)
+ {
+ m_mapping[channel_left * m_source_channels + i] = 1;
+ }
+ else if(channel_left == -1)
{
- m_mapping[channel_min1 * m_source_channels + i] = 1;
+ m_mapping[channel_right * m_source_channels + i] = 1;
}
else
{
- m_mapping[channel_min1 * m_source_channels + i] = cos(M_PI_2 * angle_min1 / angle);
- m_mapping[channel_min2 * m_source_channels + i] = cos(M_PI_2 * angle_min2 / angle);
+ m_mapping[channel_left * m_source_channels + i] = cos(M_PI_2 * angle_left / angle);
+ m_mapping[channel_right * m_source_channels + i] = cos(M_PI_2 * angle_right / angle);
}
}
diff --git a/intern/audaspace/intern/AUD_IDevice.h b/intern/audaspace/intern/AUD_IDevice.h
index 1d6f8ca6efb..f4d6635e79a 100644
--- a/intern/audaspace/intern/AUD_IDevice.h
+++ b/intern/audaspace/intern/AUD_IDevice.h
@@ -35,6 +35,7 @@
#include "AUD_IFactory.h"
#include "AUD_IReader.h"
#include "AUD_IHandle.h"
+#include "AUD_ILockable.h"
/**
* This class represents an output device for sound sources.
@@ -44,7 +45,7 @@
* \warning Thread safety must be insured so that no reader is beeing called
* twice at the same time.
*/
-class AUD_IDevice
+class AUD_IDevice : public AUD_ILockable
{
public:
/**
diff --git a/intern/audaspace/intern/AUD_ILockable.h b/intern/audaspace/intern/AUD_ILockable.h
new file mode 100644
index 00000000000..9bc417504fe
--- /dev/null
+++ b/intern/audaspace/intern/AUD_ILockable.h
@@ -0,0 +1,21 @@
+#ifndef AUD_ILOCKABLE_H
+#define AUD_ILOCKABLE_H
+
+/**
+ * This class provides an interface for lockable objects.
+ * The main reason for this interface is to be used with AUD_MutexLock.
+ */
+class AUD_ILockable
+{
+public:
+ /**
+ * Locks the object.
+ */
+ virtual void lock()=0;
+ /**
+ * Unlocks the previously locked object.
+ */
+ virtual void unlock()=0;
+};
+
+#endif // AUD_ILOCKABLE_H
diff --git a/intern/audaspace/intern/AUD_MutexLock.h b/intern/audaspace/intern/AUD_MutexLock.h
new file mode 100644
index 00000000000..b6f6d2b4334
--- /dev/null
+++ b/intern/audaspace/intern/AUD_MutexLock.h
@@ -0,0 +1,24 @@
+#ifndef AUD_MUTEXLOCK_H
+#define AUD_MUTEXLOCK_H
+
+#include "AUD_ILockable.h"
+
+class AUD_MutexLock
+{
+public:
+ inline AUD_MutexLock(AUD_ILockable& lockable) :
+ lockable(lockable)
+ {
+ lockable.lock();
+ }
+
+ inline ~AUD_MutexLock()
+ {
+ lockable.unlock();
+ }
+
+private:
+ AUD_ILockable& lockable;
+};
+
+#endif // AUD_MUTEXLOCK_H
diff --git a/intern/audaspace/intern/AUD_SequencerEntry.cpp b/intern/audaspace/intern/AUD_SequencerEntry.cpp
index 6e6e2397626..96fd15a0bf8 100644
--- a/intern/audaspace/intern/AUD_SequencerEntry.cpp
+++ b/intern/audaspace/intern/AUD_SequencerEntry.cpp
@@ -29,6 +29,7 @@
#include "AUD_SequencerEntry.h"
#include "AUD_SequencerReader.h"
+#include "AUD_MutexLock.h"
#include <cmath>
#include <limits>
@@ -87,20 +88,18 @@ void AUD_SequencerEntry::unlock()
void AUD_SequencerEntry::setSound(AUD_Reference<AUD_IFactory> sound)
{
- lock();
+ AUD_MutexLock lock(*this);
if(m_sound.get() != sound.get())
{
m_sound = sound;
m_sound_status++;
}
-
- unlock();
}
void AUD_SequencerEntry::move(float begin, float end, float skip)
{
- lock();
+ AUD_MutexLock lock(*this);
if(m_begin != begin || m_skip != skip || m_end != end)
{
@@ -109,17 +108,13 @@ void AUD_SequencerEntry::move(float begin, float end, float skip)
m_end = end;
m_pos_status++;
}
-
- unlock();
}
void AUD_SequencerEntry::mute(bool mute)
{
- lock();
+ AUD_MutexLock lock(*this);
m_muted = mute;
-
- unlock();
}
int AUD_SequencerEntry::getID() const
@@ -150,7 +145,7 @@ void AUD_SequencerEntry::updateAll(float volume_max, float volume_min, float dis
float distance_reference, float attenuation, float cone_angle_outer,
float cone_angle_inner, float cone_volume_outer)
{
- lock();
+ AUD_MutexLock lock(*this);
if(volume_max != m_volume_max)
{
@@ -199,8 +194,6 @@ void AUD_SequencerEntry::updateAll(float volume_max, float volume_min, float dis
m_cone_volume_outer = cone_volume_outer;
m_status++;
}
-
- unlock();
}
bool AUD_SequencerEntry::isRelative()
@@ -210,15 +203,13 @@ bool AUD_SequencerEntry::isRelative()
void AUD_SequencerEntry::setRelative(bool relative)
{
- lock();
+ AUD_MutexLock lock(*this);
if(m_relative != relative)
{
m_relative = relative;
m_status++;
}
-
- unlock();
}
float AUD_SequencerEntry::getVolumeMaximum()
@@ -228,12 +219,10 @@ float AUD_SequencerEntry::getVolumeMaximum()
void AUD_SequencerEntry::setVolumeMaximum(float volume)
{
- lock();
+ AUD_MutexLock lock(*this);
m_volume_max = volume;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getVolumeMinimum()
@@ -243,12 +232,10 @@ float AUD_SequencerEntry::getVolumeMinimum()
void AUD_SequencerEntry::setVolumeMinimum(float volume)
{
- lock();
+ AUD_MutexLock lock(*this);
m_volume_min = volume;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getDistanceMaximum()
@@ -258,12 +245,10 @@ float AUD_SequencerEntry::getDistanceMaximum()
void AUD_SequencerEntry::setDistanceMaximum(float distance)
{
- lock();
+ AUD_MutexLock lock(*this);
m_distance_max = distance;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getDistanceReference()
@@ -273,12 +258,10 @@ float AUD_SequencerEntry::getDistanceReference()
void AUD_SequencerEntry::setDistanceReference(float distance)
{
- lock();
+ AUD_MutexLock lock(*this);
m_distance_reference = distance;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getAttenuation()
@@ -288,12 +271,10 @@ float AUD_SequencerEntry::getAttenuation()
void AUD_SequencerEntry::setAttenuation(float factor)
{
- lock();
+ AUD_MutexLock lock(*this);
m_attenuation = factor;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getConeAngleOuter()
@@ -303,12 +284,10 @@ float AUD_SequencerEntry::getConeAngleOuter()
void AUD_SequencerEntry::setConeAngleOuter(float angle)
{
- lock();
+ AUD_MutexLock lock(*this);
m_cone_angle_outer = angle;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getConeAngleInner()
@@ -318,12 +297,10 @@ float AUD_SequencerEntry::getConeAngleInner()
void AUD_SequencerEntry::setConeAngleInner(float angle)
{
- lock();
+ AUD_MutexLock lock(*this);
m_cone_angle_inner = angle;
m_status++;
-
- unlock();
}
float AUD_SequencerEntry::getConeVolumeOuter()
@@ -333,10 +310,8 @@ float AUD_SequencerEntry::getConeVolumeOuter()
void AUD_SequencerEntry::setConeVolumeOuter(float volume)
{
- lock();
+ AUD_MutexLock lock(*this);
m_cone_volume_outer = volume;
m_status++;
-
- unlock();
}
diff --git a/intern/audaspace/intern/AUD_SequencerEntry.h b/intern/audaspace/intern/AUD_SequencerEntry.h
index 7ff6fffea11..46efc52d66b 100644
--- a/intern/audaspace/intern/AUD_SequencerEntry.h
+++ b/intern/audaspace/intern/AUD_SequencerEntry.h
@@ -33,13 +33,14 @@
#include "AUD_Reference.h"
#include "AUD_AnimateableProperty.h"
#include "AUD_IFactory.h"
+#include "AUD_ILockable.h"
#include <pthread.h>
/**
* This class represents a sequenced entry in a sequencer factory.
*/
-class AUD_SequencerEntry
+class AUD_SequencerEntry : public AUD_ILockable
{
friend class AUD_SequencerHandle;
private:
@@ -130,12 +131,12 @@ public:
/**
* Locks the entry.
*/
- void lock();
+ virtual void lock();
/**
* Unlocks the previously locked entry.
*/
- void unlock();
+ virtual void unlock();
/**
* Sets the sound of the entry.
diff --git a/intern/audaspace/intern/AUD_SequencerFactory.cpp b/intern/audaspace/intern/AUD_SequencerFactory.cpp
index fd495f467cf..2cc0a656cf1 100644
--- a/intern/audaspace/intern/AUD_SequencerFactory.cpp
+++ b/intern/audaspace/intern/AUD_SequencerFactory.cpp
@@ -30,6 +30,7 @@
#include "AUD_SequencerFactory.h"
#include "AUD_SequencerReader.h"
#include "AUD_3DMath.h"
+#include "AUD_MutexLock.h"
AUD_SequencerFactory::AUD_SequencerFactory(AUD_Specs specs, float fps, bool muted) :
m_specs(specs),
@@ -75,30 +76,24 @@ void AUD_SequencerFactory::unlock()
void AUD_SequencerFactory::setSpecs(AUD_Specs specs)
{
- lock();
+ AUD_MutexLock lock(*this);
m_specs = specs;
m_status++;
-
- unlock();
}
void AUD_SequencerFactory::setFPS(float fps)
{
- lock();
+ AUD_MutexLock lock(*this);
m_fps = fps;
-
- unlock();
}
void AUD_SequencerFactory::mute(bool muted)
{
- lock();
+ AUD_MutexLock lock(*this);
m_muted = muted;
-
- unlock();
}
bool AUD_SequencerFactory::getMute() const
@@ -113,12 +108,10 @@ float AUD_SequencerFactory::getSpeedOfSound() const
void AUD_SequencerFactory::setSpeedOfSound(float speed)
{
- lock();
+ AUD_MutexLock lock(*this);
m_speed_of_sound = speed;
m_status++;
-
- unlock();
}
float AUD_SequencerFactory::getDopplerFactor() const
@@ -128,12 +121,10 @@ float AUD_SequencerFactory::getDopplerFactor() const
void AUD_SequencerFactory::setDopplerFactor(float factor)
{
- lock();
+ AUD_MutexLock lock(*this);
m_doppler_factor = factor;
m_status++;
-
- unlock();
}
AUD_DistanceModel AUD_SequencerFactory::getDistanceModel() const
@@ -143,12 +134,10 @@ AUD_DistanceModel AUD_SequencerFactory::getDistanceModel() const
void AUD_SequencerFactory::setDistanceModel(AUD_DistanceModel model)
{
- lock();
+ AUD_MutexLock lock(*this);
m_distance_model = model;
m_status++;
-
- unlock();
}
AUD_AnimateableProperty* AUD_SequencerFactory::getAnimProperty(AUD_AnimateablePropertyType type)
@@ -168,26 +157,22 @@ AUD_AnimateableProperty* AUD_SequencerFactory::getAnimProperty(AUD_AnimateablePr
AUD_Reference<AUD_SequencerEntry> AUD_SequencerFactory::add(AUD_Reference<AUD_IFactory> sound, float begin, float end, float skip)
{
- lock();
+ AUD_MutexLock lock(*this);
AUD_Reference<AUD_SequencerEntry> entry = new AUD_SequencerEntry(sound, begin, end, skip, m_id++);
m_entries.push_front(entry);
m_entry_status++;
- unlock();
-
return entry;
}
void AUD_SequencerFactory::remove(AUD_Reference<AUD_SequencerEntry> entry)
{
- lock();
+ AUD_MutexLock lock(*this);
m_entries.remove(entry);
m_entry_status++;
-
- unlock();
}
AUD_Reference<AUD_IReader> AUD_SequencerFactory::createQualityReader()
diff --git a/intern/audaspace/intern/AUD_SequencerFactory.h b/intern/audaspace/intern/AUD_SequencerFactory.h
index 38241112020..38cbc2d1867 100644
--- a/intern/audaspace/intern/AUD_SequencerFactory.h
+++ b/intern/audaspace/intern/AUD_SequencerFactory.h
@@ -32,6 +32,7 @@
#include "AUD_IFactory.h"
#include "AUD_AnimateableProperty.h"
+#include "AUD_ILockable.h"
#include <list>
#include <pthread.h>
@@ -41,7 +42,7 @@ class AUD_SequencerEntry;
/**
* This factory represents sequenced entries to play a sound scene.
*/
-class AUD_SequencerFactory : public AUD_IFactory
+class AUD_SequencerFactory : public AUD_IFactory, public AUD_ILockable
{
friend class AUD_SequencerReader;
private:
@@ -104,12 +105,12 @@ public:
/**
* Locks the factory.
*/
- void lock();
+ virtual void lock();
/**
* Unlocks the previously locked factory.
*/
- void unlock();
+ virtual void unlock();
/**
* Sets the audio output specification.
diff --git a/intern/audaspace/intern/AUD_SequencerHandle.cpp b/intern/audaspace/intern/AUD_SequencerHandle.cpp
index f4bfae6cee7..38d2ed38a7e 100644
--- a/intern/audaspace/intern/AUD_SequencerHandle.cpp
+++ b/intern/audaspace/intern/AUD_SequencerHandle.cpp
@@ -29,6 +29,7 @@
#include "AUD_SequencerHandle.h"
#include "AUD_ReadDevice.h"
+#include "AUD_MutexLock.h"
AUD_SequencerHandle::AUD_SequencerHandle(AUD_Reference<AUD_SequencerEntry> entry, AUD_ReadDevice& device) :
m_entry(entry),
@@ -68,7 +69,7 @@ void AUD_SequencerHandle::update(float position, float frame, float fps)
{
if(!m_handle.isNull())
{
- m_entry->lock();
+ AUD_MutexLock lock(*m_entry);
if(position >= m_entry->m_end && m_entry->m_end >= 0)
m_handle->pause();
else if(position >= m_entry->m_begin)
@@ -134,7 +135,6 @@ void AUD_SequencerHandle::update(float position, float frame, float fps)
if(m_entry->m_muted)
m_handle->setVolume(0);
- m_entry->unlock();
}
}
@@ -142,11 +142,10 @@ void AUD_SequencerHandle::seek(float position)
{
if(!m_handle.isNull())
{
- m_entry->lock();
+ AUD_MutexLock lock(*m_entry);
if(position >= m_entry->m_end && m_entry->m_end >= 0)
{
m_handle->pause();
- m_entry->unlock();
return;
}
@@ -160,6 +159,5 @@ void AUD_SequencerHandle::seek(float position)
m_handle->pause();
else
m_handle->resume();
- m_entry->unlock();
}
}
diff --git a/intern/audaspace/intern/AUD_SequencerReader.cpp b/intern/audaspace/intern/AUD_SequencerReader.cpp
index 2e41a99d3db..39a4d29e6e4 100644
--- a/intern/audaspace/intern/AUD_SequencerReader.cpp
+++ b/intern/audaspace/intern/AUD_SequencerReader.cpp
@@ -28,6 +28,7 @@
#include "AUD_SequencerReader.h"
+#include "AUD_MutexLock.h"
typedef std::list<AUD_Reference<AUD_SequencerHandle> >::iterator AUD_HandleIterator;
typedef std::list<AUD_Reference<AUD_SequencerEntry> >::iterator AUD_EntryIterator;
@@ -77,7 +78,7 @@ AUD_Specs AUD_SequencerReader::getSpecs() const
void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
{
- m_factory->lock();
+ AUD_MutexLock lock(*m_factory);
if(m_factory->m_status != m_status)
{
@@ -197,8 +198,6 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
time += float(len) / float(specs.rate);
}
- m_factory->unlock();
-
m_position += length;
eos = false;
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.cpp b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
index 1d993abab73..14f0c6429e9 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.cpp
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
@@ -33,6 +33,7 @@
#include "AUD_IFactory.h"
#include "AUD_JOSResampleReader.h"
#include "AUD_LinearResampleReader.h"
+#include "AUD_MutexLock.h"
#include <cstring>
#include <cmath>
@@ -226,7 +227,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::pause()
{
if(m_status)
{
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
if(m_status == AUD_STATUS_PLAYING)
{
@@ -236,12 +237,9 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::pause()
if(m_device->m_playingSounds.empty())
m_device->playing(m_device->m_playback = false);
m_status = AUD_STATUS_PAUSED;
- m_device->unlock();
return true;
}
-
- m_device->unlock();
}
return false;
@@ -251,7 +249,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::resume()
{
if(m_status)
{
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
if(m_status == AUD_STATUS_PAUSED)
{
@@ -261,11 +259,9 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::resume()
if(!m_device->m_playback)
m_device->playing(m_device->m_playback = true);
m_status = AUD_STATUS_PLAYING;
- m_device->unlock();
return true;
}
- m_device->unlock();
}
return false;
@@ -276,7 +272,10 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::stop()
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
// AUD_XXX Create a reference of our own object so that it doesn't get
// deleted before the end of this function
@@ -292,7 +291,6 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::stop()
else
m_device->m_pausedSounds.remove(This);
- m_device->unlock();
m_status = AUD_STATUS_INVALID;
return true;
}
@@ -310,11 +308,12 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setKeep(bool keep)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- m_keep = keep;
+ if(!m_status)
+ return false;
- m_device->unlock();
+ m_keep = keep;
return true;
}
@@ -324,11 +323,12 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::seek(float position)
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- m_reader->seek((int)(position * m_reader->getSpecs().rate));
+ if(!m_status)
+ return false;
- m_device->unlock();
+ m_reader->seek((int)(position * m_reader->getSpecs().rate));
return true;
}
@@ -336,13 +336,14 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::seek(float position)
float AUD_SoftwareDevice::AUD_SoftwareHandle::getPosition()
{
if(!m_status)
- return 0.0f;
+ return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
- float position = m_reader->getPosition() / (float)m_device->m_specs.rate;
+ if(!m_status)
+ return 0.0f;
- m_device->unlock();
+ float position = m_reader->getPosition() / (float)m_device->m_specs.rate;
return position;
}
@@ -407,13 +408,14 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setStopCallback(stopCallback callba
if(!m_status)
return false;
- m_device->lock();
+ AUD_MutexLock lock(*m_device);
+
+ if(!m_status)
+ return false;
m_stop = callback;
m_stop_data = data;
- m_device->unlock();
-
return true;
}
@@ -691,7 +693,7 @@ void AUD_SoftwareDevice::mix(data_t* buffer, int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
- lock();
+ AUD_MutexLock lock(*this);
{
AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound;
@@ -775,8 +777,6 @@ void AUD_SoftwareDevice::mix(data_t* buffer, int length)
sound->pause();
}
}
-
- unlock();
}
void AUD_SoftwareDevice::setPanning(AUD_IHandle* handle, float pan)
@@ -833,12 +833,12 @@ AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> r
// play sound
AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, resampler, mapper, keep);
- lock();
+ AUD_MutexLock lock(*this);
+
m_playingSounds.push_back(sound);
if(!m_playback)
playing(m_playback = true);
- unlock();
return AUD_Reference<AUD_IHandle>(sound);
}
@@ -850,15 +850,13 @@ AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IFactory>
void AUD_SoftwareDevice::stopAll()
{
- lock();
+ AUD_MutexLock lock(*this);
while(!m_playingSounds.empty())
m_playingSounds.front()->stop();
while(!m_pausedSounds.empty())
m_pausedSounds.front()->stop();
-
- unlock();
}
void AUD_SoftwareDevice::lock()
diff --git a/intern/container/CMakeLists.txt b/intern/container/CMakeLists.txt
index b29eea37bc7..4743247af26 100644
--- a/intern/container/CMakeLists.txt
+++ b/intern/container/CMakeLists.txt
@@ -33,14 +33,9 @@ set(INC_SYS
)
set(SRC
- intern/CTR_List.cpp
-
CTR_HashedPtr.h
- CTR_List.h
CTR_Map.h
- CTR_TaggedIndex.h
- CTR_TaggedSetOps.h
- CTR_UHeap.h
)
+# infact nothing to compile!
blender_add_lib(bf_intern_ctr "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/container/CTR_HashedPtr.h b/intern/container/CTR_HashedPtr.h
index 11dc37b3625..b7ac460f270 100644
--- a/intern/container/CTR_HashedPtr.h
+++ b/intern/container/CTR_HashedPtr.h
@@ -30,8 +30,8 @@
* \ingroup ctr
*/
-#ifndef CTR_HASHEDPTR_H
-#define CTR_HASHEDPTR_H
+#ifndef __CTR_HASHEDPTR_H__
+#define __CTR_HASHEDPTR_H__
#include <stdlib.h>
@@ -43,13 +43,20 @@ inline unsigned int CTR_Hash(void *inDWord)
class CTR_HashedPtr
{
- void* m_valptr;
+ void *m_valptr;
public:
- CTR_HashedPtr(void* val) : m_valptr(val) {};
- unsigned int hash() const { return CTR_Hash(m_valptr);};
- inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;};
- void *getValue() const { return m_valptr; }
+ CTR_HashedPtr(void *val) : m_valptr(val) {
+ };
+ unsigned int hash() const {
+ return CTR_Hash(m_valptr);
+ };
+ inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) {
+ return rhs.m_valptr == lhs.m_valptr;
+ };
+ void *getValue() const {
+ return m_valptr;
+ }
};
-#endif //CTR_HASHEDPTR_H
+#endif /* __CTR_HASHEDPTR_H__ */
diff --git a/intern/container/CTR_List.h b/intern/container/CTR_List.h
deleted file mode 100644
index 404a08fddf2..00000000000
--- a/intern/container/CTR_List.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/CTR_List.h
- * \ingroup ctr
- */
-
-
-
-#ifndef CTR_LIST_H
-#define CTR_LIST_H
-
-class CTR_Link {
-public:
- CTR_Link(
- );
-
- CTR_Link(
- CTR_Link *next,
- CTR_Link *prev
- );
-
- CTR_Link *
- getNext(
- ) const;
-
- CTR_Link *
- getPrev(
- ) const;
-
- bool
- isHead(
- ) const;
-
- bool
- isTail(
- ) const;
-
- void
- insertBefore(
- CTR_Link *link
- );
-
- void
- insertAfter(
- CTR_Link *link
- );
-
- void
- remove(
- );
-
-private:
- CTR_Link *m_next;
- CTR_Link *m_prev;
-};
-
-class CTR_List {
-public:
-
- CTR_List(
- );
-
- CTR_Link *
- getHead(
- ) const;
-
- CTR_Link *
- getTail(
- ) const;
-
- void
- addHead(
- CTR_Link *link
- );
-
- void
- addTail(
- CTR_Link *link
- );
-
-private:
- CTR_Link m_head;
- CTR_Link m_tail;
-};
-
-#endif
-
diff --git a/intern/container/CTR_Map.h b/intern/container/CTR_Map.h
index 9557821d642..c278fe5330c 100644
--- a/intern/container/CTR_Map.h
+++ b/intern/container/CTR_Map.h
@@ -29,22 +29,22 @@
* \ingroup ctr
*/
-
-#ifndef CTR_MAP_H
-#define CTR_MAP_H
+#ifndef __CTR_MAP_H__
+#define __CTR_MAP_H__
template <class Key, class Value>
class CTR_Map {
private:
struct Entry {
Entry (Entry *next, Key key, Value value) :
- m_next(next),
- m_key(key),
- m_value(value) {}
+ m_next(next),
+ m_key(key),
+ m_value(value) {
+ }
Entry *m_next;
- Key m_key;
- Value m_value;
+ Key m_key;
+ Value m_value;
};
public:
@@ -63,18 +63,18 @@ public:
for (int i = 0; i < m_num_buckets; ++i) {
m_buckets[i] = 0;
- for (Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+ for (Entry *entry = map.m_buckets[i]; entry; entry = entry->m_next) {
insert(entry->m_key, entry->m_value);
+ }
}
}
- int size() {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
+ int size()
+ {
+ int count = 0;
+ for (int i = 0; i < m_num_buckets; i++) {
+ Entry *bucket = m_buckets[i];
+ while (bucket) {
bucket = bucket->m_next;
count++;
}
@@ -82,15 +82,13 @@ public:
return count;
}
- Value* at(int index) {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
- if (count==index)
- {
+ Value *at(int index)
+ {
+ int count = 0;
+ for (int i = 0; i < m_num_buckets; i++) {
+ Entry *bucket = m_buckets[i];
+ while (bucket) {
+ if (count == index) {
return &bucket->m_value;
}
bucket = bucket->m_next;
@@ -100,15 +98,13 @@ public:
return 0;
}
- Key* getKey(int index) {
- int count=0;
- for (int i=0;i<m_num_buckets;i++)
- {
- Entry* bucket = m_buckets[i];
- while(bucket)
- {
- if (count==index)
- {
+ Key *getKey(int index)
+ {
+ int count = 0;
+ for (int i = 0; i < m_num_buckets; i++) {
+ Entry *bucket = m_buckets[i];
+ while (bucket) {
+ if (count == index) {
return &bucket->m_key;
}
bucket = bucket->m_next;
@@ -118,7 +114,8 @@ public:
return 0;
}
- void clear() {
+ void clear()
+ {
for (int i = 0; i < m_num_buckets; ++i) {
Entry *entry_ptr = m_buckets[i];
@@ -131,12 +128,14 @@ public:
}
}
- ~CTR_Map() {
+ ~CTR_Map()
+ {
clear();
- delete [] m_buckets;
+ delete[] m_buckets;
}
- void insert(const Key& key, const Value& value) {
+ void insert(const Key& key, const Value& value)
+ {
Entry *entry_ptr = m_buckets[key.hash() % m_num_buckets];
while ((entry_ptr != 0) && !(key == entry_ptr->m_key)) {
entry_ptr = entry_ptr->m_next;
@@ -151,7 +150,8 @@ public:
}
}
- void remove(const Key& key) {
+ void remove(const Key& key)
+ {
Entry **entry_ptr = &m_buckets[key.hash() % m_num_buckets];
while ((*entry_ptr != 0) && !(key == (*entry_ptr)->m_key)) {
entry_ptr = &(*entry_ptr)->m_next;
@@ -164,7 +164,8 @@ public:
}
}
- Value *operator[](Key key) {
+ Value *operator[](Key key)
+ {
Entry *bucket = m_buckets[key.hash() % m_num_buckets];
while ((bucket != 0) && !(key == bucket->m_key)) {
bucket = bucket->m_next;
@@ -177,5 +178,4 @@ private:
Entry **m_buckets;
};
-#endif
-
+#endif /* __CTR_MAP_H__ */
diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h
index 8420414d6c7..0eb4e02e84f 100644
--- a/intern/container/CTR_TaggedIndex.h
+++ b/intern/container/CTR_TaggedIndex.h
@@ -29,13 +29,6 @@
* \ingroup ctr
*/
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- * Simple tagged index class.
- */
-
#ifndef __CTR_TAGGEDINDEX_H__
#define __CTR_TAGGEDINDEX_H__
@@ -53,7 +46,6 @@
#include "MEM_sys_types.h"
enum {
-
empty_tag = 0x0,
empty_index = 0xffffffff
};
@@ -191,7 +183,7 @@ public:
return (Tag() == Empty().Tag());
}
- // functionals
+ /* functionals */
struct greater : std::binary_function<CTR_TaggedIndex, CTR_TaggedIndex, bool>
{
@@ -213,7 +205,6 @@ private :
unsigned int m_val;
-};
-
-#endif
+};
+#endif /* __CTR_TAGGEDINDEX_H__ */
diff --git a/intern/container/CTR_TaggedSetOps.h b/intern/container/CTR_TaggedSetOps.h
index d30081d2d60..6ebf20b77bf 100644
--- a/intern/container/CTR_TaggedSetOps.h
+++ b/intern/container/CTR_TaggedSetOps.h
@@ -50,16 +50,16 @@
* type ObjectType must have the following public methods to be used by
* this template class:
*
- * int
+ * int
* OpenTag(void) --- return a persistent tag value for the primitive
*
- * void
+ * void
* SetOpenTag(int bla) --- set the persistent tag value for this primitive to bla.
*
- * bool
+ * bool
* SelectTag() --- return a persistent boolean tag for this primitive
*
- * void
+ * void
* SetSelectTag(bool bla) --- set the persistent boolean tag for this primitive to bla.
*
* Here persistent means that the tag should be associated with the object for the
@@ -86,16 +86,16 @@ public :
unsigned int shift
) {
- // iterate through vectors in index_list
- // iterate through individual members of each vector
- // mark each obejct that the index points to
+ /* iterate through vectors in index_list
+ * iterate through individual members of each vector
+ * mark each obejct that the index points to */
typename std::vector< std::vector<IndexType> >::const_iterator
last_vector = index_list.end();
typename std::vector< std::vector<IndexType> >::const_iterator
start_vector = index_list.begin();
- // FIXME some temporary space
+ /* FIXME some temporary space */
std::vector<IndexType> temp_union;
temp_union.reserve(64);
@@ -114,7 +114,7 @@ public :
ObjectType & prim = primitives[*start_index];
if (!prim.OpenTag()) {
- // compute the union
+ /* compute the union */
temp_union.push_back(*start_index);
}
int tag = prim.OpenTag();
@@ -126,7 +126,7 @@ public :
++tag_num;
}
- // now iterate through the union and pull out all those with the right tag
+ /* now iterate through the union and pull out all those with the right tag */
typename std::vector<IndexType>::const_iterator last_index =
temp_union.end();
@@ -138,20 +138,20 @@ public :
ObjectType & prim = primitives[*start_index];
if (prim.OpenTag() == tag_num) {
- //it's part of the intersection!
+ /* it's part of the intersection! */
output.push_back(*start_index);
- // because we're iterating through the union
- // it's safe to remove the tag at this point
+ /* because we're iterating through the union
+ * it's safe to remove the tag at this point */
prim.SetOpenTag(prim.OpenTag() & ~mask);
}
}
};
- // note not a strict set intersection!
- // if x appears twice in b and is part of the intersection
- // it will appear twice in the intersection
+ /* note not a strict set intersection!
+ * if x appears twice in b and is part of the intersection
+ * it will appear twice in the intersection */
static
void
@@ -180,7 +180,7 @@ public :
output.push_back(*start_index);
}
}
- // deselect
+ /* deselect */
last_index = a.end();
start_index = a.begin();
@@ -199,9 +199,9 @@ public :
std::vector<IndexType> &output
) {
- // iterate through vectors in index_list
- // iterate through individual members of each vector
- // mark each obejct that the index points to
+ /* iterate through vectors in index_list
+ * iterate through individual members of each vector
+ * mark each obejct that the index points to */
typename std::vector< std::vector<IndexType> >::const_iterator
last_vector = index_list.end();
@@ -220,15 +220,15 @@ public :
ObjectType & prim = primitives[*start_index];
if (!prim.SelectTag()) {
- // compute the union
+ /* compute the union */
output.push_back(*start_index);
prim.SetSelectTag(true);
}
}
}
- // now iterate through the union and reset the tags
-
+ /* now iterate through the union and reset the tags */
+
typename std::vector<IndexType>::const_iterator last_index =
output.end();
typename std::vector<IndexType>::iterator start_index =
@@ -238,7 +238,7 @@ public :
ObjectType & prim = primitives[*start_index];
prim.SetSelectTag(false);
- }
+ }
}
@@ -251,8 +251,8 @@ public :
std::vector< IndexType> &output
) {
- // iterate through b mark all
- // iterate through a and add to output all unmarked
+ /* iterate through b mark all
+ * iterate through a and add to output all unmarked */
typename std::vector<IndexType>::const_iterator last_index =
b.end();
@@ -276,7 +276,7 @@ public :
}
}
- // clean up the tags
+ /* clean up the tags */
last_index = b.end();
start_index = b.begin();
@@ -290,12 +290,11 @@ public :
private :
- // private constructor - this class is not meant for
- // instantiation
+ /* private constructor - this class is not meant for
+ * instantiation */
CTR_TaggedSetOps();
};
-#endif
-
+#endif /* __CTR_TAGGEDSETOPS_H__ */
diff --git a/intern/container/CTR_UHeap.h b/intern/container/CTR_UHeap.h
deleted file mode 100644
index 8330faa2f54..00000000000
--- a/intern/container/CTR_UHeap.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/CTR_UHeap.h
- * \ingroup ctr
- */
-
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- *
- * @author Laurence
- * @mainpage CTR_UHeap an updatable heap template class (also
- * known as an updatable priority queue)
- *
- * Todo: Make CTR_UHeapable a template class with m_key the
- * template parameter, so that arbitrary value types with
- * operators (=,>) defined can be used.
- *
- */
-
-#ifndef __CTR_UHEAP_H__
-#define __CTR_UHEAP_H__
-
-#include <vector>
-
-#include "MEM_NonCopyable.h"
-
-class CTR_UHeapable {
-
-public:
- int &
- HeapPos(
- ) {
- return m_ind;
- };
- float &
- HeapKey(
- ) {
- return m_key;
- };
-
- const
- float &
- HeapKey(
- ) const {
- return m_key;
- };
-
- const
- int &
- HeapPos(
- ) const {
- return m_ind;
- };
-
-private:
-
- float m_key;
- int m_ind;
-
-protected:
-
- CTR_UHeapable(
- ) : m_key(0),
- m_ind(0)
- {
- };
-
- ~CTR_UHeapable(
- ) {
- };
-};
-
-template <class HeapType>
-class CTR_UHeap : public MEM_NonCopyable
-{
-
-public:
-
- static
- CTR_UHeap *
- New(
- ) {
- return new CTR_UHeap();
- }
-
- void
- MakeHeap(
- HeapType *base
- ) {
- int i;
- int start = Parent(m_vector.size() - 1);
- for (i = start; i >= 0; --i) {
- DownHeap(base, i);
- }
- };
-
- void
- Insert(
- HeapType *base,
- int elem
- ) {
- // add element to vector
- m_vector.push_back(elem);
- base[elem].HeapPos() = m_vector.size() - 1;
-
- // push the element up the heap
- UpHeap(base, m_vector.size() - 1);
- }
-
- // access to the vector for initial loading of elements
-
- std::vector<int> &
- HeapVector(
- ) {
- return m_vector;
- };
-
-
- void
- Remove(
- HeapType *base,
- int i
- ) {
-
- // exchange with last element - pop last
- // element and move up or down the heap as appropriate
- if (m_vector.empty()) {
- assert(false);
- }
-
- if (i != int(m_vector.size()) - 1) {
-
- Swap(base, i, m_vector.size() - 1);
- m_vector.pop_back();
-
- if (!m_vector.empty()) {
- UpHeap(base, i);
- DownHeap(base, i);
- }
- }
- else {
- m_vector.pop_back();
- }
- }
-
- int
- Top(
- ) const {
- if (m_vector.empty()) return -1;
- return m_vector[0];
- }
-
-
- void
- SC_Heap(
- HeapType *base
- ) {
- int i;
- for (i = 1; i < int(m_vector.size()); i++) {
-
- CTR_UHeapable *elem = base + m_vector[i];
- CTR_UHeapable *p_elem = base + m_vector[Parent(i)];
-
- assert(p_elem->HeapKey() >= elem->HeapKey());
- assert(elem->HeapPos() == i);
- }
-
- };
-
-
- ~CTR_UHeap(
- ) {
- };
-
-
-private:
-
- CTR_UHeap(
- ) {
- };
-
-
- std::vector<int> m_vector;
-
-private:
- void
- Swap(
- HeapType *base,
- int i,
- int j
- ) {
- std::swap(m_vector[i], m_vector[j]);
-
- CTR_UHeapable *heap_i = base + m_vector[i];
- CTR_UHeapable *heap_j = base + m_vector[j];
-
- // Exchange heap positions
- heap_i->HeapPos() = i;
- heap_j->HeapPos() = j;
- }
-
- int
- Parent(
- unsigned int i
- ) {
- return (i - 1) >> 1;
- }
- int
- Left(
- int i
- ) {
- return (i << 1) + 1;
- }
-
- int
- Right(
- int i
- ) {
- return (i << 1) + 2;
- }
-
- float
- HeapVal(
- HeapType *base,
- int i
- ) {
- return base[m_vector[i]].HeapKey();
- }
-
- void
- DownHeap(
- HeapType *base,
- int i
- ) {
- int heap_size = m_vector.size();
-
- int l = Left(i);
- int r = Right(i);
-
- int largest;
- if (l < heap_size && HeapVal(base, l) > HeapVal(base, i)) {
- largest = l;
- }
- else {
- largest = i;
- }
-
- if (r < heap_size && HeapVal(base, r) > HeapVal(base, largest)) {
- largest = r;
- }
-
- if (largest != i) {
- // exchange i and largest
- Swap(base, i, largest);
- DownHeap(base, largest);
- }
- }
-
- void
- UpHeap(
- HeapType *base,
- int i
- ) {
-
- // swap parents untill it's found a place in the heap < it's parent or
- // top of heap
-
- while (i > 0) {
- int p = Parent(i);
- if (HeapVal(base, i) < HeapVal(base, p)) {
- break;
- }
- Swap(base, p, i);
- i = p;
- }
- }
-};
-
-#endif
-
diff --git a/intern/container/intern/CTR_List.cpp b/intern/container/intern/CTR_List.cpp
deleted file mode 100644
index c72d3ccf0d8..00000000000
--- a/intern/container/intern/CTR_List.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file container/intern/CTR_List.cpp
- * \ingroup ctr
- */
-
-
-#include "CTR_List.h"
-
-
-CTR_Link::CTR_Link() :
- m_next(0),
- m_prev(0)
-{
-}
-
-CTR_Link::CTR_Link(CTR_Link *next, CTR_Link *prev) :
- m_next(next),
- m_prev(prev)
-{
-}
-
-CTR_Link *
-CTR_Link::getNext() const
-{
- return m_next;
-}
-
-CTR_Link *
-CTR_Link::getPrev() const
-{
- return m_prev;
-}
-
-bool
-CTR_Link::isHead() const
-{
- return m_prev == 0;
-}
-
-bool
-CTR_Link::isTail() const
-{
- return m_next == 0;
-}
-
-void
-CTR_Link::insertBefore(CTR_Link *link)
-{
- m_next = link;
- m_prev = link->m_prev;
- m_next->m_prev = this;
- m_prev->m_next = this;
-}
-
-void
-CTR_Link::insertAfter(CTR_Link *link)
-{
- m_next = link->m_next;
- m_prev = link;
- m_next->m_prev = this;
- m_prev->m_next = this;
-}
-
-void
-CTR_Link::remove()
-{
- m_next->m_prev = m_prev;
- m_prev->m_next = m_next;
-}
-
-
-CTR_List::CTR_List() :
- m_head(&m_tail, 0),
- m_tail(0, &m_head)
-{
-}
-
-CTR_Link *
-CTR_List:: getHead() const
-{
- return m_head.getNext();
-}
-
-CTR_Link *
-CTR_List::getTail() const
-{
- return m_tail.getPrev();
-}
-
-void
-CTR_List::addHead(CTR_Link *link)
-{
- link->insertAfter(&m_head);
-}
-
-void
-CTR_List::addTail(CTR_Link *link)
-{
- link->insertBefore(&m_tail);
-}
-
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 5c68b7f2cb4..0b8ca6e0fbe 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -291,9 +291,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
cls.use_progressive_refine = BoolProperty(
name="Progressive Refine",
description="Instead of rendering each tile until it is finished, "
- "refine the whole image progressively. "
- "This renders somewhat slower, "
- "but time can be saved by manually stopping the render when the noise is low enough",
+ "refine the whole image progressively "
+ "(this renders somewhat slower, "
+ "but time can be saved by manually stopping the render when the noise is low enough)",
default=False,
)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index f125740efd5..52d2c6a2d89 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -988,6 +988,7 @@ def get_panels():
bpy.types.DATA_PT_context_mesh,
bpy.types.DATA_PT_context_camera,
bpy.types.DATA_PT_context_lamp,
+ bpy.types.DATA_PT_context_speaker,
bpy.types.DATA_PT_texture_space,
bpy.types.DATA_PT_curve_texture_space,
bpy.types.DATA_PT_mball_texture_space,
@@ -998,10 +999,14 @@ def get_panels():
bpy.types.DATA_PT_camera,
bpy.types.DATA_PT_camera_display,
bpy.types.DATA_PT_lens,
+ bpy.types.DATA_PT_speaker,
+ bpy.types.DATA_PT_distance,
+ bpy.types.DATA_PT_cone,
bpy.types.DATA_PT_customdata,
bpy.types.DATA_PT_custom_props_mesh,
bpy.types.DATA_PT_custom_props_camera,
bpy.types.DATA_PT_custom_props_lamp,
+ bpy.types.DATA_PT_custom_props_speaker,
bpy.types.TEXTURE_PT_clouds,
bpy.types.TEXTURE_PT_wood,
bpy.types.TEXTURE_PT_marble,
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index 000d412ab28..af16e210301 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -411,8 +411,14 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
bcam->farclip *= 0.5f;
bcam->nearclip = -bcam->farclip;
+ float sensor_size;
+ if(bcam->sensor_fit == BlenderCamera::VERTICAL)
+ sensor_size = bcam->sensor_height;
+ else
+ sensor_size = bcam->sensor_width;
+
bcam->type = CAMERA_ORTHOGRAPHIC;
- bcam->ortho_scale = b_rv3d.view_distance();
+ bcam->ortho_scale = b_rv3d.view_distance() * sensor_size / b_v3d.lens();
}
bcam->zoom *= 2.0f;
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 3fdd4418eb6..05db9f55380 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -178,15 +178,12 @@ static PassType get_pass_type(BL::RenderPass b_pass)
static BL::RenderResult begin_render_result(BL::RenderEngine b_engine, int x, int y, int w, int h, const char *layername)
{
- RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, x, y, w, h, layername);
- PointerRNA rrptr;
- RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
- return BL::RenderResult(rrptr);
+ return b_engine.begin_result(x, y, w, h, layername);
}
static void end_render_result(BL::RenderEngine b_engine, BL::RenderResult b_rr, bool cancel = false)
{
- RE_engine_end_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data, (int)cancel);
+ b_engine.end_result(b_rr, (int)cancel);
}
void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_update_only)
@@ -335,16 +332,16 @@ void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::Re
/* copy pixels */
if(buffers->get_pass_rect(pass_type, exposure, rtile.sample, components, &pixels[0]))
- rna_RenderPass_rect_set(&b_pass.ptr, &pixels[0]);
+ b_pass.rect(&pixels[0]);
}
}
/* copy combined pass */
if(buffers->get_pass_rect(PASS_COMBINED, exposure, rtile.sample, 4, &pixels[0]))
- rna_RenderLayer_rect_set(&b_rlay.ptr, &pixels[0]);
+ b_rlay.rect(&pixels[0]);
/* tag result as updated */
- RE_engine_update_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
+ b_engine.update_result(b_rr);
}
void BlenderSession::write_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile)
@@ -496,11 +493,11 @@ void BlenderSession::update_status_progress()
status += " | " + substatus;
if(status != last_status) {
- RE_engine_update_stats((RenderEngine*)b_engine.ptr.data, "", (timestatus + status).c_str());
+ b_engine.update_stats("", (timestatus + status).c_str());
last_status = status;
}
if(progress != last_progress) {
- RE_engine_update_progress((RenderEngine*)b_engine.ptr.data, progress);
+ b_engine.update_progress(progress);
last_progress = progress;
}
}
@@ -508,7 +505,7 @@ void BlenderSession::update_status_progress()
void BlenderSession::tag_update()
{
/* tell blender that we want to get another update callback */
- engine_tag_update((RenderEngine*)b_engine.ptr.data);
+ b_engine.tag_update();
}
void BlenderSession::tag_redraw()
@@ -520,13 +517,13 @@ void BlenderSession::tag_redraw()
/* offline render, redraw if timeout passed */
if(time_dt() - last_redraw_time > 1.0) {
- engine_tag_redraw((RenderEngine*)b_engine.ptr.data);
+ b_engine.tag_redraw();
last_redraw_time = time_dt();
}
}
else {
/* tell blender that we want to redraw */
- engine_tag_redraw((RenderEngine*)b_engine.ptr.data);
+ b_engine.tag_redraw();
}
}
@@ -534,7 +531,7 @@ void BlenderSession::test_cancel()
{
/* test if we need to cancel rendering */
if(background)
- if(RE_engine_test_break((RenderEngine*)b_engine.ptr.data))
+ if(b_engine.test_break())
session->progress.set_cancel("Cancelled");
}
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index db34a9fe9aa..0ce1a7dcf28 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -583,7 +583,34 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
PtrSockMap proxy_map;
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
- if(b_node->is_a(&RNA_NodeGroup)) {
+ if(b_node->mute()) {
+ BL::Node::inputs_iterator b_input;
+ BL::Node::outputs_iterator b_output;
+ bool found_match = false;
+
+ /* this is slightly different than blender logic, we just connect a
+ * single pair for of input/output, but works ok for the node we have */
+ for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
+ if(b_input->is_linked()) {
+ for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
+ if(b_output->is_linked() && b_input->type() == b_output->type()) {
+ ProxyNode *proxy = new ProxyNode(convert_socket_type(b_input->type()), convert_socket_type(b_output->type()));
+ graph->add(proxy);
+
+ proxy_map[b_input->ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+ proxy_map[b_output->ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+ found_match = true;
+
+ break;
+ }
+ }
+ }
+
+ if(found_match)
+ break;
+ }
+ }
+ else if(b_node->is_a(&RNA_NodeGroup)) {
/* add proxy converter nodes for inputs and outputs */
BL::NodeGroup b_gnode(*b_node);
BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
@@ -663,7 +690,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
/* from sock */
if(b_from_node) {
- if (b_from_node.is_a(&RNA_NodeGroup))
+ if (b_from_node.mute() || b_from_node.is_a(&RNA_NodeGroup))
from_pair = proxy_map[b_from_sock.ptr.data];
else
from_pair = node_socket_map_pair(node_map, b_from_node, b_from_sock);
@@ -673,7 +700,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
/* to sock */
if(b_to_node) {
- if (b_to_node.is_a(&RNA_NodeGroup))
+ if (b_to_node.mute() || b_to_node.is_a(&RNA_NodeGroup))
to_pair = proxy_map[b_to_sock.ptr.data];
else
to_pair = node_socket_map_pair(node_map, b_to_node, b_to_sock);
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 24a561116ec..c63f72c68c6 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -397,7 +397,15 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
}
else
params.progressive = true;
-
+
+ /* shading system - scene level needs full refresh */
+ int shadingsystem = RNA_enum_get(&cscene, "shading_system");
+
+ if(shadingsystem == 0)
+ params.shadingsystem = SessionParams::SVM;
+ else if(shadingsystem == 1)
+ params.shadingsystem = SessionParams::OSL;
+
return params;
}
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index da8f30ea169..079320e909c 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -30,29 +30,7 @@
* todo: clean this up ... */
extern "C" {
-
-struct RenderEngine;
-struct RenderResult;
-
-ID *rna_Object_to_mesh(void *_self, void *reports, void *scene, int apply_modifiers, int settings);
-void rna_Main_meshes_remove(void *bmain, void *reports, void *mesh);
-void rna_Object_create_duplilist(void *ob, void *reports, void *sce, int settings);
-void rna_Object_free_duplilist(void *ob);
-void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values);
-void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
-struct RenderResult *RE_engine_begin_result(struct RenderEngine *engine, int x, int y, int w, int h, const char *layername);
-void RE_engine_update_result(struct RenderEngine *engine, struct RenderResult *result);
-void RE_engine_end_result(struct RenderEngine *engine, struct RenderResult *result, int cancel);
-int RE_engine_test_break(struct RenderEngine *engine);
-void RE_engine_update_stats(struct RenderEngine *engine, const char *stats, const char *info);
-void RE_engine_update_progress(struct RenderEngine *engine, float progress);
-void engine_tag_redraw(void *engine);
-void engine_tag_update(void *engine);
-int rna_Object_is_modified(void *ob, void *scene, int settings);
-int rna_Object_is_deform_modified(void *ob, void *scene, int settings);
void BLI_timestr(double _time, char *str);
-void rna_ColorRamp_eval(void *coba, float position, float color[4]);
-void rna_Scene_frame_set(void *scene, int frame, float subframe);
void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(void *iuser, void *ima, char *path);
}
@@ -61,10 +39,7 @@ CCL_NAMESPACE_BEGIN
static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
{
- ID *data = rna_Object_to_mesh(self.ptr.data, NULL, scene.ptr.data, apply_modifiers, (render)? 2: 1);
- PointerRNA ptr;
- RNA_id_pointer_create(data, &ptr);
- return BL::Mesh(ptr);
+ return self.to_mesh(NULL, scene, apply_modifiers, (render)? 2: 1);
}
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
@@ -72,34 +47,37 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
for(int i = 0; i < size; i++) {
float color[4];
- rna_ColorRamp_eval(ramp.ptr.data, i/(float)(size-1), color);
+ ramp.evaluate(i/(float)(size-1), color);
data[i] = make_float4(color[0], color[1], color[2], color[3]);
}
}
static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh)
{
- rna_Main_meshes_remove(data.ptr.data, NULL, mesh.ptr.data);
+ /* TODO: BlendData.meshes ideally should be also a subclass of BlendDataMeshes */
+ BL::BlendDataMeshes mesh_data(data.ptr);
+
+ mesh_data.remove(NULL, mesh);
}
static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
{
- rna_Object_create_duplilist(self.ptr.data, NULL, scene.ptr.data, 2);
+ self.dupli_list_create(NULL, scene, 2);
}
static inline void object_free_duplilist(BL::Object self)
{
- rna_Object_free_duplilist(self.ptr.data);
+ self.dupli_list_clear();
}
static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
{
- return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
+ return self.is_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
}
static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview)
{
- return rna_Object_is_deform_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
+ return self.is_deform_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
}
static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, int cfra)
@@ -112,7 +90,7 @@ static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, in
static inline void scene_frame_set(BL::Scene scene, int frame)
{
- rna_Scene_frame_set(scene.ptr.data, frame, 0.0f);
+ scene.frame_set(frame, 0.0f);
}
/* Utilities */
diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index 5c00f7b7a38..a0d10a46bfc 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -54,7 +54,7 @@ public:
// Subtree functions
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const;
- float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
+ float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
void deleteSubtree();
uint update_visibility();
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 9a4d364a9b8..5d3f23d954a 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -28,6 +28,7 @@
#include "util_math.h"
#include "util_opencl.h"
#include "util_opengl.h"
+#include "util_time.h"
#include "util_types.h"
#include "util_vector.h"
@@ -188,6 +189,18 @@ vector<DeviceInfo>& Device::available_devices()
{
static vector<DeviceInfo> devices;
static bool devices_init = false;
+ static double device_update_time = 0.0;
+
+ /* only update device list if we're not actively rendering already, things
+ * could go very wrong if a device suddenly becomes (un)available. also do
+ * it only every 5 seconds. it not super cpu intensive but don't want to do
+ * it on every redraw. */
+ if(devices_init) {
+ if(!TaskScheduler::active() && (time_dt() > device_update_time + 5.0)) {
+ devices.clear();
+ devices_init = false;
+ }
+ }
if(!devices_init) {
#ifdef WITH_CUDA
@@ -211,6 +224,7 @@ vector<DeviceInfo>& Device::available_devices()
#endif
devices_init = true;
+ device_update_time = time_dt();
}
return devices;
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 6ba25881910..d24c7d4128c 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -45,10 +45,12 @@ set(SRC_HEADERS
kernel_types.h
)
-set(SRC_SVM_HEADERS
+set(SRC_CLOSURE_HEADERS
closure/bsdf.h
closure/bsdf_ashikhmin_velvet.h
+ closure/bsdf_diffuse.h
closure/bsdf_microfacet.h
+ closure/bsdf_oren_nayar.h
closure/bsdf_reflection.h
closure/bsdf_refraction.h
closure/bsdf_transparent.h
@@ -56,7 +58,8 @@ set(SRC_SVM_HEADERS
closure/bsdf_westin.h
closure/emissive.h
closure/volume.h
-
+)
+set(SRC_SVM_HEADERS
svm/svm.h
svm/svm_attribute.h
svm/svm_bsdf.h
@@ -109,7 +112,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_BITS 32)
endif()
- set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_UTIL_HEADERS})
+ set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
set(cuda_cubins)
foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
@@ -138,7 +141,7 @@ endif()
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
-add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS})
+add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS})
if(WITH_CYCLES_OPTIMIZED_KERNEL)
set_source_files_properties(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_OPTIMIZED_KERNEL_FLAGS}")
@@ -161,6 +164,7 @@ endif()
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/kernel)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
+delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/closure)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h
index e3c8b796e9c..d70485fd6cf 100644
--- a/intern/cycles/kernel/kernel_bvh.h
+++ b/intern/cycles/kernel/kernel_bvh.h
@@ -444,16 +444,11 @@ __device_inline bool bvh_intersect_motion(KernelGlobals *kg, const Ray *ray, con
__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
{
#ifdef __OBJECT_MOTION__
-#if !defined(__KERNEL_CUDA__) || (__CUDA_ARCH__ >= 210)
if(kernel_data.bvh.have_motion)
return bvh_intersect_motion(kg, ray, visibility, isect);
else
return bvh_intersect(kg, ray, visibility, isect);
#else
- /* todo: fix cuda sm 2.0 motion blur */
- return bvh_intersect(kg, ray, visibility, isect);
-#endif
-#else
return bvh_intersect(kg, ray, visibility, isect);
#endif
}
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index c341269f4ca..930fffa3f40 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -109,9 +109,13 @@ CCL_NAMESPACE_BEGIN
#define __BACKGROUND_MIS__
#define __AO__
#define __CAMERA_MOTION__
+
+#ifndef __KERNEL_CUDA__
#define __OBJECT_MOTION__
#endif
+#endif
+
//#define __SOBOL_FULL_SCREEN__
/* Shader Evaluation */
@@ -148,9 +152,7 @@ enum PathTraceDimension {
PRNG_BOUNCE_NUM = 8
};
-/* these flag values correspond exactly to OSL defaults, so be careful not to
- * change this, or if you do, set the "raytypes" shading system attribute with
- * your own new ray types and bitflag values.
+/* these flags values correspond to raytypes in osl.cpp, so keep them in sync!
*
* for ray visibility tests in BVH traversal, the upper 20 bits are used for
* layer visibility tests. */
@@ -411,7 +413,7 @@ typedef struct ShaderData {
/* view/incoming direction */
float3 I;
/* shader id */
- int shader;
+ int shader;
/* booleans describing shader, see ShaderDataFlag */
int flag;
diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt
index 2c459fd714b..da5441f11e0 100644
--- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt
@@ -48,6 +48,7 @@ set(SRC_OSL
node_particle_info.osl
node_rgb_ramp.osl
node_separate_rgb.osl
+ node_set_normal.osl
node_sky_texture.osl
node_texture_coordinate.osl
node_translucent_bsdf.osl
diff --git a/intern/cycles/kernel/osl/nodes/node_bump.osl b/intern/cycles/kernel/osl/nodes/node_bump.osl
index dbc554e0a72..24db1b24458 100644
--- a/intern/cycles/kernel/osl/nodes/node_bump.osl
+++ b/intern/cycles/kernel/osl/nodes/node_bump.osl
@@ -22,25 +22,28 @@
* Morten S. Mikkelsen, 2010 */
surface node_bump(
+ normal NormalIn = N,
+ float Strength = 0.0,
float SampleCenter = 0.0,
float SampleX = 0.0,
float SampleY = 0.0,
output normal Normal = N)
{
- float dx = SampleX - SampleCenter;
- float dy = SampleY - SampleCenter;
-
+ /* get surface tangents from normal */
vector dPdx = Dx(P);
vector dPdy = Dy(P);
- vector Rx = cross(dPdy, N);
- vector Ry = cross(N, dPdx);
+ vector Rx = cross(dPdy, NormalIn);
+ vector Ry = cross(NormalIn, dPdx);
+ /* compute surface gradient and determinant */
float det = dot(dPdx, Rx);
- vector surfgrad = dx * Rx + dy * Ry;
+ vector surfgrad = (SampleX - SampleCenter) * Rx + (SampleY - SampleCenter) * Ry;
- surfgrad *= 0.1; /* todo: remove this factor */
+ surfgrad *= Strength;
+ float absdet = fabs(det);
- Normal = normalize(abs(det) * N - sign(det) * surfgrad);
+ /* compute and output perturbed normal */
+ Normal = normalize(absdet * NormalIn - sign(det) * surfgrad);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
index 419e93e1518..32ef430d93b 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
@@ -27,7 +27,7 @@ shader node_convert_from_normal(
output point Point = point(0.0, 0.0, 0.0))
{
Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0);
- ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0));
+ ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
Vector = vector(Normal[0], Normal[1], Normal[2]);
Color = color(Normal[0], Normal[1], Normal[2]);
Point = point(Normal[0], Normal[1], Normal[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
index cedd200f088..a9435c8abf4 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
@@ -27,7 +27,7 @@ shader node_convert_from_point(
output normal Normal = normal(0.0, 0.0, 0.0))
{
Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0);
- ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0));
+ ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
Vector = vector(Point[0], Point[1], Point[2]);
Color = color(Point[0], Point[1], Point[2]);
Normal = normal(Point[0], Point[1], Point[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
index a9f43a40074..4516f92c753 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
@@ -27,7 +27,7 @@ shader node_convert_from_vector(
output normal Normal = normal(0.0, 0.0, 0.0))
{
Val = (Vector[0] + Vector[1] + Vector[2]) * (1.0 / 3.0);
- ValInt = (int)((Normal[0] + Normal[1] + Normal[2])*(1.0/3.0));
+ ValInt = (int)((Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0));
Color = color(Vector[0], Vector[1], Vector[2]);
Point = point(Vector[0], Vector[1], Vector[2]);
Normal = normal(Vector[0], Vector[1], Vector[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_image_texture.osl b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
index e005f1f4245..6393605e6b5 100644
--- a/intern/cycles/kernel/osl/nodes/node_image_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
@@ -19,16 +19,102 @@
#include "stdosl.h"
#include "node_color.h"
+color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha)
+{
+ color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha);
+
+ if (color_space == "sRGB")
+ rgb = color_srgb_to_scene_linear(rgb);
+
+ return rgb;
+}
+
shader node_image_texture(
point Vector = P,
string filename = "",
string color_space = "sRGB",
+ string projection = "Flat",
+ float projection_blend = 0.0,
output color Color = color(0.0, 0.0, 0.0),
output float Alpha = 1.0)
{
- Color = (color)texture(filename, Vector[0], 1.0 - Vector[1], "wrap", "periodic", "alpha", Alpha);
+ if (projection == "Flat") {
+ Color = image_texture_lookup(filename, color_space, Vector[0], Vector[1], Alpha);
+ }
+ else if (projection == "Box") {
+ /* object space normal */
+ vector Nob = transform("world", "object", N);
- if (color_space == "sRGB")
- Color = color_srgb_to_scene_linear(Color);
+ /* project from direction vector to barycentric coordinates in triangles */
+ Nob = vector(fabs(Nob[0]), fabs(Nob[1]), fabs(Nob[2]));
+ Nob /= (Nob[0] + Nob[1] + Nob[2]);
+
+ /* basic idea is to think of this as a triangle, each corner representing
+ * one of the 3 faces of the cube. in the corners we have single textures,
+ * in between we blend between two textures, and in the middle we a blend
+ * between three textures.
+ *
+ * the Nxyz values are the barycentric coordinates in an equilateral
+ * triangle, which in case of blending, in the middle has a smaller
+ * equilateral triangle where 3 textures blend. this divides things into
+ * 7 zones, with an if () test for each zone */
+
+ vector weight = vector(0.0, 0.0, 0.0);
+ float blend = projection_blend;
+ float limit = 0.5*(1.0 + blend);
+
+ /* first test for corners with single texture */
+ if (Nob[0] > limit*(Nob[0] + Nob[1]) && Nob[0] > limit*(Nob[0] + Nob[2])) {
+ weight[0] = 1.0;
+ }
+ else if (Nob[1] > limit*(Nob[0] + Nob[1]) && Nob[1] > limit*(Nob[1] + Nob[2])) {
+ weight[1] = 1.0;
+ }
+ else if (Nob[2] > limit*(Nob[0] + Nob[2]) && Nob[2] > limit*(Nob[1] + Nob[2])) {
+ weight[2] = 1.0;
+ }
+ else if (blend > 0.0) {
+ /* in case of blending, test for mixes between two textures */
+ if (Nob[2] < (1.0 - limit)*(Nob[1] + Nob[0])) {
+ weight[0] = Nob[0] / (Nob[0] + Nob[1]);
+ weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+ weight[1] = 1.0 - weight[0];
+ }
+ else if (Nob[0] < (1.0 - limit)*(Nob[1] + Nob[2])) {
+ weight[1] = Nob[1] / (Nob[1] + Nob[2]);
+ weight[1] = clamp((weight[1] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+ weight[2] = 1.0 - weight[1];
+ }
+ else if (Nob[1] < (1.0 - limit) * (Nob[0] + Nob[2])) {
+ weight[0] = Nob[0] / (Nob[0] + Nob[2]);
+ weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0);
+ weight[2] = 1.0 - weight[0];
+ }
+ else {
+ /* last case, we have a mix between three */
+ weight[0] = ((2.0 - limit) * Nob[0] + (limit - 1.0)) / (2.0 * limit - 1.0);
+ weight[1] = ((2.0 - limit) * Nob[1] + (limit - 1.0)) / (2.0 * limit - 1.0);
+ weight[2] = ((2.0 - limit) * Nob[2] + (limit - 1.0)) / (2.0 * limit - 1.0);
+ }
+ }
+
+ Color = color(0.0, 0.0, 0.0);
+ Alpha = 0.0;
+
+ float tmp_alpha;
+
+ if (weight[0] > 0.0) {
+ Color += weight[0]*image_texture_lookup(filename, color_space, Vector[1], Vector[2], tmp_alpha);
+ Alpha += weight[0]*tmp_alpha;
+ }
+ if (weight[1] > 0.0) {
+ Color += weight[1]*image_texture_lookup(filename, color_space, Vector[0], Vector[2], tmp_alpha);
+ Alpha += weight[1]*tmp_alpha;
+ }
+ if (weight[2] > 0.0) {
+ Color += weight[2]*image_texture_lookup(filename, color_space, Vector[1], Vector[0], tmp_alpha);
+ Alpha += weight[2]*tmp_alpha;
+ }
+ }
}
diff --git a/intern/cycles/kernel/osl/nodes/node_light_falloff.osl b/intern/cycles/kernel/osl/nodes/node_light_falloff.osl
index fd68594a1d8..3877b6d5bdc 100644
--- a/intern/cycles/kernel/osl/nodes/node_light_falloff.osl
+++ b/intern/cycles/kernel/osl/nodes/node_light_falloff.osl
@@ -29,9 +29,9 @@ shader node_light_falloff(
float strength = Strength;
getattribute("std::ray_length", ray_length);
- if(Smooth > 0.0) {
+ if (Smooth > 0.0) {
float squared = ray_length*ray_length;
- strength *= squared/(Smooth + squared);
+ strength *= squared / (Smooth + squared);
}
/* Quadratic */
diff --git a/intern/cycles/kernel/osl/nodes/node_mapping.osl b/intern/cycles/kernel/osl/nodes/node_mapping.osl
index f342837d3c9..2e720edfc7e 100644
--- a/intern/cycles/kernel/osl/nodes/node_mapping.osl
+++ b/intern/cycles/kernel/osl/nodes/node_mapping.osl
@@ -20,9 +20,9 @@
shader node_mapping(
matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
- point Vector = point(0.0, 0.0, 0.0),
- output point Vector_ = point(0.0, 0.0, 0.0))
+ point VectorIn = point(0.0, 0.0, 0.0),
+ output point VectorOut = point(0.0, 0.0, 0.0))
{
- Vector_ = transform(Matrix, Vector);
+ VectorOut = transform(Matrix, VectorIn);
}
diff --git a/intern/decimation/intern/LOD_MeshException.h b/intern/cycles/kernel/osl/nodes/node_set_normal.osl
index 67bd8188c41..27a4b2f5b8b 100644
--- a/intern/decimation/intern/LOD_MeshException.h
+++ b/intern/cycles/kernel/osl/nodes/node_set_normal.osl
@@ -1,5 +1,5 @@
/*
- * ***** BEGIN GPL LICENSE BLOCK *****
+ * Copyright 2012, Blender Foundation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -14,42 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshException.h
- * \ingroup decimation
*/
+#include "stdosl.h"
-#ifndef __LOD_MESHEXCEPTION_H__
-#define __LOD_MESHEXCEPTION_H__
-
-class LOD_MeshException {
-
-public :
-
- // stick in more error types as you think of them
-
- enum ExceptionType{
- e_non_manifold,
- e_search_error
- } m_e_type;
-
- LOD_MeshException (
- ExceptionType type
- ) : m_e_type (type)
- {
- }
-};
-
-#endif
+surface node_set_normal(
+ normal Direction = N,
+ output normal Normal = N)
+{
+ N = Direction;
+ Normal = Direction;
+}
diff --git a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl b/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
index 883135d2a43..405ed118c2b 100644
--- a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
+++ b/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
@@ -19,8 +19,9 @@
#include "stdosl.h"
shader node_texture_coordinate(
- normal Normal = N,
+ normal NormalIn = N,
int is_background = 0,
+ int from_dupli = 0,
string bump_offset = "center",
output point Generated = point(0.0, 0.0, 0.0),
@@ -28,6 +29,7 @@ shader node_texture_coordinate(
output point Object = point(0.0, 0.0, 0.0),
output point Camera = point(0.0, 0.0, 0.0),
output point Window = point(0.0, 0.0, 0.0),
+ output normal Normal = normal(0.0, 0.0, 0.0),
output point Reflection = point(0.0, 0.0, 0.0))
{
if (is_background) {
@@ -37,27 +39,40 @@ shader node_texture_coordinate(
point Pcam = transform("camera", "world", point(0, 0, 0));
Camera = transform("camera", P + Pcam);
Window = transform("NDC", P + Pcam);
+ Normal = NormalIn;
Reflection = I;
}
else {
- getattribute("std::generated", Generated);
- getattribute("std::uv", UV);
+ if (from_dupli) {
+ getattribute("std::dupli_generated", Generated);
+ getattribute("std::dupli_uv", UV);
+ }
+ else {
+ getattribute("std::generated", Generated);
+ getattribute("std::uv", UV);
+ }
+
Object = transform("object", P);
Camera = transform("camera", P);
Window = transform("NDC", P);
- Reflection = reflect(I, Normal);
+ Normal = transform("world", "object", NormalIn);
+ Reflection = reflect(I, NormalIn);
}
if (bump_offset == "dx") {
- Generated += Dx(Generated);
- UV += Dx(UV);
+ if (!from_dupli) {
+ Generated += Dx(Generated);
+ UV += Dx(UV);
+ }
Object += Dx(Object);
Camera += Dx(Camera);
Window += Dx(Window);
}
else if (bump_offset == "dy") {
- Generated += Dy(Generated);
- UV += Dy(UV);
+ if (!from_dupli) {
+ Generated += Dy(Generated);
+ UV += Dy(UV);
+ }
Object += Dy(Object);
Camera += Dy(Camera);
Window += Dy(Window);
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h
index 873e03673c3..574cb685db5 100644
--- a/intern/cycles/kernel/osl/osl_closures.h
+++ b/intern/cycles/kernel/osl/osl_closures.h
@@ -77,7 +77,7 @@ public:
int shaderdata_flag() const { return m_shaderdata_flag; }
ClosureType shaderclosure_type() const { return sc.type; }
- virtual void blur(float roughness);
+ virtual void blur(float roughness) = 0;
virtual float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
virtual float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index 83574c91d31..7c415e22012 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -287,16 +287,26 @@ static void set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, v
if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
{
- float3 *fval = (float3 *)val;
- fval[0] = f[0];
+ float *fval = (float *)val;
+
+ fval[0] = f[0].x;
+ fval[1] = f[0].y;
+ fval[2] = f[0].z;
+
if (derivatives) {
- fval[1] = f[1];
- fval[2] = f[2];
+ fval[3] = f[1].x;
+ fval[4] = f[1].y;
+ fval[5] = f[1].z;
+
+ fval[6] = f[2].x;
+ fval[7] = f[2].y;
+ fval[8] = f[2].z;
}
}
else {
float *fval = (float *)val;
fval[0] = average(f[0]);
+
if (derivatives) {
fval[1] = average(f[1]);
fval[2] = average(f[2]);
@@ -309,16 +319,25 @@ static void set_attribute_float(float f[3], TypeDesc type, bool derivatives, voi
if (type == TypeDesc::TypePoint || type == TypeDesc::TypeVector ||
type == TypeDesc::TypeNormal || type == TypeDesc::TypeColor)
{
- float3 *fval = (float3 *)val;
- fval[0] = make_float3(f[0], f[0], f[0]);
+ float *fval = (float *)val;
+ fval[0] = f[0];
+ fval[1] = f[1];
+ fval[2] = f[2];
+
if (derivatives) {
- fval[1] = make_float3(f[1], f[2], f[1]);
- fval[2] = make_float3(f[2], f[2], f[2]);
+ fval[3] = f[1];
+ fval[4] = f[1];
+ fval[5] = f[1];
+
+ fval[6] = f[2];
+ fval[7] = f[2];
+ fval[8] = f[2];
}
}
else {
float *fval = (float *)val;
fval[0] = f[0];
+
if (derivatives) {
fval[1] = f[1];
fval[2] = f[2];
@@ -377,6 +396,20 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float(fval, type, derivatives, val);
return true;
}
+ else if (name == "std::dupli_generated") {
+ float3 fval[3];
+ fval[0] = object_dupli_generated(kg, sd->object);
+ fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
+ set_attribute_float3(fval, type, derivatives, val);
+ return true;
+ }
+ else if (name == "std::dupli_uv") {
+ float3 fval[3];
+ fval[0] = object_dupli_uv(kg, sd->object);
+ fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
+ set_attribute_float3(fval, type, derivatives, val);
+ return true;
+ }
else if (name == "std::material_index") {
float fval[3];
fval[0] = shader_pass_id(kg, sd);
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index 662419418e3..9877856fec2 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -265,7 +265,7 @@ __device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float *s
* between three textures.
*
* the Nxyz values are the barycentric coordinates in an equilateral
- * triangle, which in case of blending in the middle has a smaller
+ * triangle, which in case of blending, in the middle has a smaller
* equilateral triangle where 3 textures blend. this divides things into
* 7 zones, with an if() test for each zone */
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 76267e9d014..2cdab3a6560 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -225,6 +225,8 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("color_space", "Linear");
else
compiler.parameter("color_space", "sRGB");
+ compiler.parameter("projection", projection);
+ compiler.parameter("projection_blend", projection_blend);
compiler.add(this, "node_image_texture");
}
@@ -1122,6 +1124,9 @@ void ConvertNode::compile(SVMCompiler& compiler)
compiler.add_node(NODE_CONVERT, NODE_CONVERT_IV, in->stack_offset, out->stack_offset);
}
else if(to == SHADER_SOCKET_FLOAT) {
+ compiler.stack_assign(in);
+ compiler.stack_assign(out);
+
if(from == SHADER_SOCKET_COLOR)
/* color to float */
compiler.add_node(NODE_CONVERT, NODE_CONVERT_CF, in->stack_offset, out->stack_offset);
@@ -1130,6 +1135,9 @@ void ConvertNode::compile(SVMCompiler& compiler)
compiler.add_node(NODE_CONVERT, NODE_CONVERT_VF, in->stack_offset, out->stack_offset);
}
else if(to == SHADER_SOCKET_INT) {
+ compiler.stack_assign(in);
+ compiler.stack_assign(out);
+
if(from == SHADER_SOCKET_COLOR)
/* color to int */
compiler.add_node(NODE_CONVERT, NODE_CONVERT_CI, in->stack_offset, out->stack_offset);
@@ -1701,7 +1709,7 @@ void GeometryNode::compile(OSLCompiler& compiler)
TextureCoordinateNode::TextureCoordinateNode()
: ShaderNode("texture_coordinate")
{
- add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
+ add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
add_output("Generated", SHADER_SOCKET_POINT);
add_output("Normal", SHADER_SOCKET_NORMAL);
add_output("UV", SHADER_SOCKET_POINT);
@@ -1823,6 +1831,8 @@ void TextureCoordinateNode::compile(OSLCompiler& compiler)
if(compiler.background)
compiler.parameter("is_background", true);
+
+ compiler.parameter("from_dupli", from_dupli);
compiler.add(this, "node_texture_coordinate");
}
@@ -2770,7 +2780,7 @@ BumpNode::BumpNode()
{
/* this input is used by the user, but after graph transform it is no longer
* used and moved to sampler center/x/y instead */
- add_input("Height", SHADER_SOCKET_NORMAL);
+ add_input("Height", SHADER_SOCKET_FLOAT);
add_input("SampleCenter", SHADER_SOCKET_FLOAT);
add_input("SampleX", SHADER_SOCKET_FLOAT);
@@ -2909,7 +2919,7 @@ void SetNormalNode::compile(SVMCompiler& compiler)
void SetNormalNode::compile(OSLCompiler& compiler)
{
- compiler.add(this, "set_normal");
+ compiler.add(this, "node_set_normal");
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 21e6c7749b8..638bfa8634e 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -59,6 +59,22 @@ OSLShaderManager::OSLShaderManager()
//ss->attribute("statistics:level", 1);
ss->attribute("searchpath:shader", path_get("shader").c_str());
+ /* our own ray types */
+ static const char *raytypes[] = {
+ "camera", /* PATH_RAY_CAMERA */
+ "reflection", /* PATH_RAY_REFLECT */
+ "refraction", /* PATH_RAY_TRANSMIT */
+ "diffuse", /* PATH_RAY_DIFFUSE */
+ "glossy", /* PATH_RAY_GLOSSY */
+ "singular", /* PATH_RAY_SINGULAR */
+ "transparent", /* PATH_RAY_TRANSPARENT */
+ "shadow", /* PATH_RAY_SHADOW_OPAQUE */
+ "shadow", /* PATH_RAY_SHADOW_TRANSPARENT */
+ };
+
+ const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]);
+ ss->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
+
OSLShader::register_closures(ss);
}
@@ -209,6 +225,10 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
if(strcmp(input->name, "Normal") == 0)
return true;
}
+ else if(node->name == ustring("bump")) {
+ if(strcmp(input->name, "Height") == 0)
+ return true;
+ }
else if(current_type == SHADER_TYPE_DISPLACEMENT && input->link && input->link->parent->name == ustring("bump"))
return true;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 65b20f1dd2c..bf8d8ade37d 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -34,10 +34,15 @@
CCL_NAMESPACE_BEGIN
+/* Note about preserve_tile_device option for tile manager:
+ * progressive refine and viewport rendering does requires tiles to
+ * always be allocated for the same device
+ */
Session::Session(const SessionParams& params_)
: params(params_),
tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution,
- (params.background)? 1: max(params.device.multi_devices.size(), 1))
+ params.background == false || params.progressive_refine, params.background,
+ max(params.device.multi_devices.size(), 1))
{
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
@@ -181,6 +186,7 @@ void Session::run_gpu()
start_time = time_dt();
reset_time = time_dt();
paused_time = 0.0;
+ last_update_time = time_dt();
if(!params.background)
progress.set_start_time(start_time + paused_time);
@@ -334,7 +340,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
/* get next tile from manager */
Tile tile;
- int device_num = (params.background)? 0: device->device_number(tile_device);
+ int device_num = device->device_number(tile_device);
if(!tile_manager.next_tile(tile, device_num))
return false;
@@ -378,20 +384,15 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
/* allocate buffers */
if(params.progressive_refine) {
- int tile_x = rtile.x / params.tile_size.x;
- int tile_y = rtile.y / params.tile_size.y;
-
- int tile_index = tile_y * tile_manager.state.tile_w + tile_x;
-
tile_lock.lock();
if(tile_buffers.size() == 0)
tile_buffers.resize(tile_manager.state.num_tiles, NULL);
- tilebuffers = tile_buffers[tile_index];
+ tilebuffers = tile_buffers[tile.index];
if(tilebuffers == NULL) {
tilebuffers = new RenderBuffers(tile_device);
- tile_buffers[tile_index] = tilebuffers;
+ tile_buffers[tile.index] = tilebuffers;
tilebuffers->reset(tile_device, buffer_params);
}
@@ -447,6 +448,8 @@ void Session::run_cpu()
{
bool tiles_written = false;
+ last_update_time = time_dt();
+
{
/* reset once to start */
thread_scoped_lock reset_lock(delayed_reset.mutex);
@@ -807,6 +810,15 @@ void Session::tonemap()
bool Session::update_progressive_refine(bool cancel)
{
int sample = tile_manager.state.sample + 1;
+ bool write = sample == params.samples || cancel;
+
+ double current_time = time_dt();
+
+ if (current_time - last_update_time < 1.0f) {
+ /* if last sample was processed, we need to write buffers anyway */
+ if (!write)
+ return false;
+ }
if(params.progressive_refine) {
foreach(RenderBuffers *buffers, tile_buffers) {
@@ -814,14 +826,16 @@ bool Session::update_progressive_refine(bool cancel)
rtile.buffers = buffers;
rtile.sample = sample;
- if(rtile.sample == params.samples || cancel)
+ if(write)
write_render_tile_cb(rtile);
else
update_render_tile_cb(rtile);
}
}
- return sample == params.samples;
+ last_update_time = current_time;
+
+ return write;
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index dc3e7504766..8941c6ac459 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -57,6 +57,8 @@ public:
double reset_timeout;
double text_timeout;
+ enum { OSL, SVM } shadingsystem;
+
SessionParams()
{
background = false;
@@ -73,6 +75,8 @@ public:
cancel_timeout = 0.1;
reset_timeout = 0.1;
text_timeout = 1.0;
+
+ shadingsystem = SVM;
}
bool modified(const SessionParams& params)
@@ -89,7 +93,8 @@ public:
&& threads == params.threads
&& cancel_timeout == params.cancel_timeout
&& reset_timeout == params.reset_timeout
- && text_timeout == params.text_timeout); }
+ && text_timeout == params.text_timeout
+ && shadingsystem == params.shadingsystem); }
};
@@ -179,6 +184,7 @@ protected:
double paused_time;
/* progressive refine */
+ double last_update_time;
bool update_progressive_refine(bool cancel);
vector<RenderBuffers *> tile_buffers;
diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp
index 02c0ee640a3..c294239bac0 100644
--- a/intern/cycles/render/tile.cpp
+++ b/intern/cycles/render/tile.cpp
@@ -23,12 +23,15 @@
CCL_NAMESPACE_BEGIN
-TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_, int num_devices_)
+TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_,
+ bool preserve_tile_device_, bool background_, int num_devices_)
{
progressive = progressive_;
tile_size = tile_size_;
start_resolution = start_resolution_;
num_devices = num_devices_;
+ preserve_tile_device = preserve_tile_device_;
+ background = background_;
BufferParams buffer_params;
reset(buffer_params, 0);
@@ -70,7 +73,47 @@ void TileManager::set_samples(int num_samples_)
num_samples = num_samples_;
}
-void TileManager::set_tiles()
+/* splits image into tiles and assigns equal amount of tiles to every render device */
+void TileManager::gen_tiles_global()
+{
+ int resolution = state.resolution_divider;
+ int image_w = max(1, params.width/resolution);
+ int image_h = max(1, params.height/resolution);
+
+ state.tiles.clear();
+
+ int tile_w = (tile_size.x >= image_w)? 1: (image_w + tile_size.x - 1)/tile_size.x;
+ int tile_h = (tile_size.y >= image_h)? 1: (image_h + tile_size.y - 1)/tile_size.y;
+ int sub_w = (image_w + tile_w - 1)/tile_w;
+ int sub_h = (image_h + tile_h - 1)/tile_h;
+
+ int num_logical_devices = preserve_tile_device? num_devices: 1;
+ int num = min(image_h, num_logical_devices);
+ int tile_index = 0;
+
+ int tiles_per_device = (tile_w * tile_h + num - 1) / num;
+ int cur_device = 0, cur_tiles = 0;
+
+ for(int tile_y = 0; tile_y < tile_h; tile_y++) {
+ for(int tile_x = 0; tile_x < tile_w; tile_x++, tile_index++) {
+ int x = tile_x * sub_w;
+ int y = tile_y * sub_h;
+ int w = (tile_x == tile_w-1)? image_w - x: sub_w;
+ int h = (tile_y == tile_h-1)? image_h - y: sub_h;
+
+ state.tiles.push_back(Tile(tile_index, x, y, w, h, cur_device));
+ cur_tiles++;
+
+ if(cur_tiles == tiles_per_device) {
+ cur_tiles = 0;
+ cur_device++;
+ }
+ }
+ }
+}
+
+/* slices image into as much pieces as how many devices are rendering this image */
+void TileManager::gen_tiles_sliced()
{
int resolution = state.resolution_divider;
int image_w = max(1, params.width/resolution);
@@ -78,7 +121,9 @@ void TileManager::set_tiles()
state.tiles.clear();
- int num = min(image_h, num_devices);
+ int num_logical_devices = preserve_tile_device? num_devices: 1;
+ int num = min(image_h, num_logical_devices);
+ int tile_index = 0;
for(int device = 0; device < num; device++) {
int device_y = (image_h/num)*device;
@@ -90,20 +135,30 @@ void TileManager::set_tiles()
int sub_h = (device_h + tile_h - 1)/tile_h;
for(int tile_y = 0; tile_y < tile_h; tile_y++) {
- for(int tile_x = 0; tile_x < tile_w; tile_x++) {
+ for(int tile_x = 0; tile_x < tile_w; tile_x++, tile_index++) {
int x = tile_x * sub_w;
int y = tile_y * sub_h;
int w = (tile_x == tile_w-1)? image_w - x: sub_w;
int h = (tile_y == tile_h-1)? device_h - y: sub_h;
- state.tiles.push_back(Tile(x, y + device_y, w, h, device));
+ state.tiles.push_back(Tile(tile_index, x, y + device_y, w, h, device));
}
}
}
+}
+
+void TileManager::set_tiles()
+{
+ int resolution = state.resolution_divider;
+ int image_w = max(1, params.width/resolution);
+ int image_h = max(1, params.height/resolution);
+
+ if(background)
+ gen_tiles_global();
+ else
+ gen_tiles_sliced();
state.num_tiles = state.tiles.size();
- state.tile_w = (tile_size.x >= image_w) ? 1 : (image_w + tile_size.x - 1) / tile_size.x;
- state.tile_h = (tile_size.y >= image_h) ? 1 : (image_h + tile_size.y - 1) / tile_size.y;
state.buffer.width = image_w;
state.buffer.height = image_h;
@@ -122,13 +177,10 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
int image_w = max(1, params.width/resolution);
int image_h = max(1, params.height/resolution);
- int num = min(image_h, num_devices);
-
- int device_y = (image_h / num) * device;
- int device_h = (device == num - 1) ? image_h - device * (image_h / num) : image_h / num;
+ int logical_device = preserve_tile_device? device: 0;
- int64_t centx = image_w / 2, centy = device_y + device_h / 2, tot = 1;
- int64_t mindist = (int64_t) image_w * (int64_t) device_h;
+ int64_t centx = image_w / 2, centy = image_h / 2, tot = 1;
+ int64_t mindist = (int64_t) image_w * (int64_t) image_h;
/* find center of rendering tiles, image center counts for 1 too */
for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
@@ -145,7 +197,7 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
/* closest of the non-rendering tiles */
for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
- if(iter->device == device && iter->rendering == false) {
+ if(iter->device == logical_device && iter->rendering == false) {
Tile &cur_tile = *iter;
int64_t distx = centx - (cur_tile.x + cur_tile.w / 2);
@@ -162,11 +214,28 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
return best;
}
+list<Tile>::iterator TileManager::next_simple_tile(int device)
+{
+ list<Tile>::iterator iter;
+
+ int logical_device = preserve_tile_device? device: 0;
+
+ for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
+ if(iter->device == logical_device && iter->rendering == false)
+ return iter;
+ }
+
+ return state.tiles.end();
+}
+
bool TileManager::next_tile(Tile& tile, int device)
{
list<Tile>::iterator tile_it;
- tile_it = next_center_tile(device);
+ if(background)
+ tile_it = next_center_tile(device);
+ else
+ tile_it = next_simple_tile(device);
if(tile_it != state.tiles.end()) {
tile_it->rendering = true;
diff --git a/intern/cycles/render/tile.h b/intern/cycles/render/tile.h
index 587dfbe4f1a..6f7a8f20734 100644
--- a/intern/cycles/render/tile.h
+++ b/intern/cycles/render/tile.h
@@ -30,6 +30,7 @@ CCL_NAMESPACE_BEGIN
class Tile {
public:
+ int index;
int x, y, w, h;
int device;
bool rendering;
@@ -37,8 +38,8 @@ public:
Tile()
{}
- Tile(int x_, int y_, int w_, int h_, int device_)
- : x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
+ Tile(int index_, int x_, int y_, int w_, int h_, int device_)
+ : index(index_), x(x_), y(y_), w(w_), h(h_), device(device_), rendering(false) {}
};
/* Tile Manager */
@@ -54,12 +55,11 @@ public:
int resolution_divider;
int num_tiles;
int num_rendered_tiles;
- int tile_w;
- int tile_h;
list<Tile> tiles;
} state;
- TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, int num_devices = 1);
+ TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution,
+ bool preserve_tile_device, bool background, int num_devices = 1);
~TileManager();
void reset(BufferParams& params, int num_samples);
@@ -77,7 +77,38 @@ protected:
int start_resolution;
int num_devices;
- list<Tile>::iterator next_center_tile(int device = 0);
+ /* in some cases it is important that the same tile will be returned for the same
+ * device it was originally generated for (i.e. viewport rendering when buffer is
+ * allocating once for tile and then always used by it)
+ *
+ * in other cases any tile could be handled by any device (i.e. final rendering
+ * without progressive refine)
+ */
+ bool preserve_tile_device;
+
+ /* for background render tiles should exactly match render parts generated from
+ * blender side, which means image first gets split into tiles and then tiles are
+ * assigning to render devices
+ *
+ * however viewport rendering expects tiles to be allocated in a special way,
+ * meaning image is being sliced horizontally first and every device handles
+ * it's own slice
+ */
+ bool background;
+
+ /* splits image into tiles and assigns equal amount of tiles to every render device */
+ void gen_tiles_global();
+
+ /* slices image into as much pieces as how many devices are rendering this image */
+ void gen_tiles_sliced();
+
+ /* returns closest tile to center of rendered tiles
+ * mimics behavior of blender internal's tile order
+ */
+ list<Tile>::iterator next_center_tile(int device);
+
+ /* returns first unhandled tile starting from left bottom corner of the image */
+ list<Tile>::iterator next_simple_tile(int device);
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/subd/subd_build.cpp b/intern/cycles/subd/subd_build.cpp
index 312980f1fa2..8e84da7f019 100644
--- a/intern/cycles/subd/subd_build.cpp
+++ b/intern/cycles/subd/subd_build.cpp
@@ -333,7 +333,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
/* @@ this probably does not provide watertight results!! (1/3 + 1/3 + 1/3 != 1) */
/* distribute weight to all verts */
- stencil->get(eid1, vert) += beta * costerm1_b / 3.0f;
+ stencil->get(eid1, vert) += beta * costerm1_b / 3.0f;
stencil->get(eid1, edge->to()) += beta * costerm1_b / 3.0f;
stencil->get(eid1, edge->next->to()) += beta * costerm1_b / 3.0f;
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
index 401a503f540..a2f284479c7 100644
--- a/intern/cycles/util/util_task.h
+++ b/intern/cycles/util/util_task.h
@@ -95,6 +95,7 @@ public:
static void exit();
static int num_threads() { return threads.size(); }
+ static bool active() { return users != 0; }
protected:
friend class TaskPool;
diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt
deleted file mode 100644
index 73b67d7f3b1..00000000000
--- a/intern/decimation/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- .
- ../container
- ../guardedalloc
- ../memutil
- ../moto/include
-)
-
-set(INC_SYS
-
-)
-
-set(SRC
- intern/LOD_EdgeCollapser.cpp
- intern/LOD_ExternNormalEditor.cpp
- intern/LOD_FaceNormalEditor.cpp
- intern/LOD_ManMesh2.cpp
- intern/LOD_MeshPrimitives.cpp
- intern/LOD_QSDecimator.cpp
- intern/LOD_QuadricEditor.cpp
- intern/LOD_decimation.cpp
-
- extern/LOD_decimation.h
- intern/LOD_DecimationClass.h
- intern/LOD_EdgeCollapser.h
- intern/LOD_ExternBufferEditor.h
- intern/LOD_ExternNormalEditor.h
- intern/LOD_FaceNormalEditor.h
- intern/LOD_ManMesh2.h
- intern/LOD_MeshBounds.h
- intern/LOD_MeshException.h
- intern/LOD_MeshPrimitives.h
- intern/LOD_QSDecimator.h
- intern/LOD_Quadric.h
- intern/LOD_QuadricEditor.h
-)
-
-blender_add_lib(bf_intern_decimate "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
deleted file mode 100644
index 6f4befb3ffa..00000000000
--- a/intern/decimation/SConscript
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = env.Glob('intern/*.cpp')
-
-incs = '. ../moto/include ../container ../memutil ../guardedalloc'
-
-env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )
diff --git a/intern/decimation/extern/LOD_decimation.h b/intern/decimation/extern/LOD_decimation.h
deleted file mode 100644
index 4c52cb18577..00000000000
--- a/intern/decimation/extern/LOD_decimation.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/extern/LOD_decimation.h
- * \ingroup decimation
- */
-
-
-/**
-
- * @author Laurence Bourn
- * @date 6/7/2001
- *
- * This is the external interface for the decimation module.
- */
-
-#ifndef __LOD_DECIMATION_H__
-#define __LOD_DECIMATION_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * External decimation structure
- */
-
-typedef struct LOD_Decimation_Info {
- float * vertex_buffer;
- float * vertex_normal_buffer;
- int * triangle_index_buffer;
- int vertex_num;
- int face_num;
- void * intern;
-} LOD_Decimation_Info;
-
-typedef LOD_Decimation_Info* LOD_Decimation_InfoPtr;
-
-/**
- * Create internal mesh representation from
- * LOD_Decimation_Info structure.
- * @return 1 on successful loading
- * @return 0 on failure
- * @warning This should be changed to return an enumeration
- * detailing the error encountered
- */
-
-extern int LOD_LoadMesh(LOD_Decimation_InfoPtr info);
-
-/**
- * Allocate and Compute internal data strucures required for
- * decimation.
- * @return 1 on successful computation of data
- * @return 0 on failure
- * @warning This should be changed to return an enumeration
- * detailing the error encountered
- */
-
-extern int LOD_PreprocessMesh(LOD_Decimation_InfoPtr info);
-
-/**
- * Once both the stages above have been completed
- * this function collapses a single edge in the mesh.
- * The LOD_Decimation_Info structure is updated
- * to represent the new mesh.
- * @return 1 if an edge was collapsed.
- * @return 0 if no suitable edge was found to be collapsable
- * You should stop calling this method in this case
- * @warning Do not expect that the order of polygons, vertices or
- * vertex normals will be preserved by this operation. This function
- * returns a packed array of polygons and vertices and so necessarily
- * the order will be different. This means you should not expect to
- * find the same polygon in the same place in the polygon array after
- * this function has been called.
- */
-
-extern int LOD_CollapseEdge(LOD_Decimation_InfoPtr info);
-
-/**
- * Free any memory the decimation process used
- * during the decimation process
- * @return 1 if internal data successfully freed
- * @return 0 if no data was freed
- */
-
-extern int LOD_FreeDecimationData(LOD_Decimation_InfoPtr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __LOD_DECIMATION_H__
-
diff --git a/intern/decimation/intern/LOD_DecimationClass.h b/intern/decimation/intern/LOD_DecimationClass.h
deleted file mode 100644
index ecf2e4e6790..00000000000
--- a/intern/decimation/intern/LOD_DecimationClass.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_DecimationClass.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_DECIMATIONCLASS_H__
-#define __LOD_DECIMATIONCLASS_H__
-
-#include "MEM_SmartPtr.h"
-#include "MEM_NonCopyable.h"
-
-#include "LOD_ManMesh2.h"
-#include "LOD_QSDecimator.h"
-#include "LOD_ExternNormalEditor.h"
-#include "../extern/LOD_decimation.h"
-#include "LOD_ExternBufferEditor.h"
-
-
-class LOD_DecimationClass : public MEM_NonCopyable
-{
-public :
-
- enum {
- e_not_loaded,
- e_loaded,
- e_preprocessed
- } m_e_decimation_state;
-
-
- static
- LOD_DecimationClass *
- New(
- LOD_Decimation_InfoPtr extern_info
- ) {
- // create everything
-
- MEM_SmartPtr<LOD_DecimationClass> output(new LOD_DecimationClass());
- MEM_SmartPtr<LOD_ManMesh2> mesh(LOD_ManMesh2::New());
- MEM_SmartPtr<LOD_ExternBufferEditor> extern_editor(LOD_ExternBufferEditor::New(extern_info));
-
- if (mesh == NULL || extern_editor == NULL) return NULL;
- MEM_SmartPtr<LOD_ExternNormalEditor> normals(LOD_ExternNormalEditor::New(extern_info,mesh.Ref()));
-
- if (normals == NULL) return NULL;
- MEM_SmartPtr<LOD_QSDecimator> decimator(LOD_QSDecimator::New(
- mesh.Ref(),
- normals.Ref(),
- extern_editor.Ref()
- ));
- if (decimator == NULL || output == NULL) return NULL;
-
- output->m_mesh = mesh.Release();
- output->m_decimator = decimator.Release();
- output->m_normals = normals.Release();
- output->m_extern_editor = extern_editor.Release();
-
- return output.Release();
- }
-
- LOD_ManMesh2 &
- Mesh(
- ){
- return m_mesh.Ref();
- }
-
- LOD_QSDecimator &
- Decimator(
- ) {
- return m_decimator.Ref();
- }
-
- LOD_ExternNormalEditor &
- FaceEditor(
- ){
- return m_normals.Ref();
- }
-
-private :
-
- LOD_DecimationClass(
- ) : m_e_decimation_state(e_not_loaded) {
- };
-
- MEM_SmartPtr<LOD_ManMesh2> m_mesh;
- MEM_SmartPtr<LOD_QSDecimator> m_decimator;
- MEM_SmartPtr<LOD_ExternNormalEditor> m_normals;
- MEM_SmartPtr<LOD_ExternBufferEditor> m_extern_editor;
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.cpp b/intern/decimation/intern/LOD_EdgeCollapser.cpp
deleted file mode 100644
index 1405d6f53fa..00000000000
--- a/intern/decimation/intern/LOD_EdgeCollapser.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_EdgeCollapser.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_EdgeCollapser.h"
-
-#include "LOD_ManMesh2.h"
-#include "CTR_TaggedSetOps.h"
-#include <algorithm>
-#include <functional>
-
-
-using namespace std;
-
-
- LOD_EdgeCollapser *
-LOD_EdgeCollapser::
-New(
-){
- return new LOD_EdgeCollapser();
-}
-
-
- bool
-LOD_EdgeCollapser::
-TJunctionTest(
- LOD_ManMesh2 &mesh,
- vector<LOD_EdgeInd> &e_v0v1,
- LOD_EdgeInd collapse_edge
-){
-
- // we need to copy the edges in e_v0v1 from the mesh
- // into a new buffer -> we are going to modify them
-
- int original_size = e_v0v1.size();
- if (original_size == 0) return true;
-
- vector<LOD_Edge> &edge_set = mesh.EdgeSet();
-
- LOD_VertexInd c_v0 = edge_set[collapse_edge].m_verts[0];
- LOD_VertexInd c_v1 = edge_set[collapse_edge].m_verts[1];
-
- vector<LOD_Edge> temp_edges;
- temp_edges.reserve(e_v0v1.size());
-
- vector<LOD_EdgeInd>::iterator edge_it = e_v0v1.begin();
- vector<LOD_EdgeInd>::const_iterator edge_end = e_v0v1.end();
-
- for (;edge_it != edge_end; ++edge_it) {
- temp_edges.push_back(edge_set[*edge_it]);
- }
-
- // in the copied edges replace all instances of c_v0 with c_v1
-
- vector<LOD_Edge>::iterator e_it = temp_edges.begin();
- vector<LOD_Edge>::const_iterator e_it_end = temp_edges.end();
-
- for (; e_it != e_it_end; ++e_it) {
-
- if (e_it->m_verts[0] == c_v0) {
- e_it->m_verts[0] = c_v1;
- }
- if (e_it->m_verts[1] == c_v0) {
- e_it->m_verts[1] = c_v1;
- }
-
- // normalize the edge
- if (int(e_it->m_verts[0]) > int(e_it->m_verts[1])) {
- LOD_EdgeInd temp = e_it->m_verts[0];
- e_it->m_verts[0] = e_it->m_verts[1];
- e_it->m_verts[1] = temp;
- }
- }
-
- // sort the edges using the edge less functional
-
- sort(temp_edges.begin(),temp_edges.end(),LOD_EdgeCollapser::less());
- // count the unique edges.
-
- e_it = temp_edges.begin();
- e_it_end = temp_edges.end();
-
- int coincedent_edges = 0;
-
- vector<LOD_Edge>::const_iterator last_edge = e_it;
- ++e_it;
-
- for (; e_it != e_it_end; ++e_it) {
-
- if ((e_it->m_verts[0] == last_edge->m_verts[0]) &&
- (e_it->m_verts[1] == last_edge->m_verts[1])
- ) {
- ++coincedent_edges;
- }
- last_edge = e_it;
- }
-
- // now if the collapse edge is a boundary edges
- // then we are alloved at most one coincedent edge
-
- // otherwise at most 2 coincedent edges
-
- if (edge_set[collapse_edge].BoundaryEdge()) {
- return (coincedent_edges > 1);
- } else {
- return (coincedent_edges > 2);
- }
-
-
-}
-
-
-
- bool
-LOD_EdgeCollapser::
-CollapseEdge(
- LOD_EdgeInd ei,
- LOD_ManMesh2 &mesh,
- vector<LOD_EdgeInd> & degenerate_edges,
- vector<LOD_FaceInd> & degenerate_faces,
- vector<LOD_VertexInd> & degenerate_vertices,
- vector<LOD_EdgeInd> & new_edges,
- vector<LOD_FaceInd> & update_faces,
- vector<LOD_VertexInd> & update_vertices
-){
-
- vector<LOD_Vertex> &verts = mesh.VertexSet();
- vector<LOD_Edge> &edges = mesh.EdgeSet();
- vector<LOD_TriFace> &faces = mesh.FaceSet();
-
- // shouldn't do this (use mesh interface instead!)
- LOD_VertexInd v0_ind = edges[ei].m_verts[0];
- LOD_VertexInd v1_ind = edges[ei].m_verts[1];
-#if 0
- LOD_Vertex &v0 = verts[v0_ind];
- LOD_Vertex &v1 = verts[v1_ind];
-#endif
- vector<vector<LOD_EdgeInd> > e_v01(2);
- e_v01[0].reserve(32);
- e_v01[1].reserve(32);
-
- mesh.VertexEdges(v0_ind,e_v01[0]);
- mesh.VertexEdges(v1_ind,e_v01[1]);
-
-
- // compute the union of e_v0 and e_v1 -> this is the degenerate edges of the collapse
- // we remove old edges and replace edges inside the collapse zone with new ones
-
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Union(e_v01,edges,degenerate_edges);
-
- vector< vector<LOD_FaceInd> > p_v01(2);
- p_v01[0].reserve(32);
- p_v01[1].reserve(32);
-
- mesh.VertexFaces(v0_ind,p_v01[0]);
- mesh.VertexFaces(v1_ind,p_v01[1]);
-
- // compute the union of p_v0 anf p_v1
- vector<LOD_FaceInd> p_v0v1;
- p_v0v1.reserve(32);
-
- CTR_TaggedSetOps<LOD_FaceInd,LOD_TriFace>::Union(p_v01,faces,p_v0v1);
-
- // compute the union of all the edges in p_v0v1 this is the collapse zone
-
- vector<vector<LOD_EdgeInd> > e_input_vectors(p_v0v1.size());
-
- vector<LOD_FaceInd>::iterator p_v0v1_end = p_v0v1.end();
- vector<LOD_FaceInd>::iterator p_v0v1_start = p_v0v1.begin();
-
- vector<vector<LOD_FaceInd> >::iterator vector_insert_it = e_input_vectors.begin();
-
- for (;p_v0v1_start != p_v0v1_end; ++p_v0v1_start , ++vector_insert_it) {
- mesh.FaceEdges(*p_v0v1_start,*vector_insert_it);
- }
-
- vector<LOD_EdgeInd> collapse_zone;
- collapse_zone.reserve(32);
-
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Union(e_input_vectors,edges,collapse_zone);
-
- // compute the ring edges = collpase_zone - e_v0v1
-
- vector<LOD_EdgeInd> edge_ring;
- edge_ring.reserve(32);
-
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::Difference(collapse_zone,degenerate_edges,edges,edge_ring);
-
- // T Junction test
- //////////////////
- // At this point we check to see if any of the polygons
- // in p_v0v1 are coninceddent - this leads
- // to errors later on if we try and insert a polygon
- // into the mesh to an edge which already has 2 polygons.
-
- // not that t junctions occur naturally from edge collapses
- // and are not just the result of coincedent polygons
- // for example consider collapsing an edge that forms part
- // of a triangular bottle neck.
-
- // Really we need to make sure that we don't create t-junctions.
-
- // I think that a sufficient test is to check the number of
- // coincedent edge pairs after a collapse. If it is more than 2
- // then collapsing the edge may result in an undeleted edge
- // sharing more than 2 polygons. This test probably is too
- // restictive though.
-
- // To perform this test we need to make a copy of the edges
- // in e_v0v1. We then apply the contraction to these edge
- // copies. Sort them using a function that places coincedent
- // edges next to each other. And then count the number
- // of coincedent pairs.
-
- // Of course we have to do this test before we change any of the
- // mesh -> so we can back out safely.
-
- if (TJunctionTest(mesh,degenerate_edges,ei)) return false;
-
- // Compute the set of possibly degenerate vertices
- // this is the union of all the vertices of polygons
- // of v0 and v1
-
- vector<LOD_FaceInd>::iterator face_it = p_v0v1.begin();
- vector<LOD_FaceInd>::const_iterator face_end = p_v0v1.end();
-
-
- vector<vector<LOD_VertexInd> > p_v0v1_vertices(p_v0v1.size());
-
- for (int i = 0; face_it != face_end; ++face_it, ++i) {
- mesh.FaceVertices(*face_it,p_v0v1_vertices[i]);
- }
-
- vector<LOD_VertexInd> vertex_ring;
- vertex_ring.reserve(32);
-
- CTR_TaggedSetOps<LOD_VertexInd,LOD_Vertex>::Union(p_v0v1_vertices,verts,vertex_ring);
-
- // remove all the internal edges e_v0v1 from the mesh.
- // for each edge remove the egde from it's vertices edge lists.
-
- vector<LOD_EdgeInd>::iterator edge_it = degenerate_edges.begin();
- vector<LOD_EdgeInd>::const_iterator edge_end = degenerate_edges.end();
-
- for (; !(edge_it == edge_end); ++edge_it) {
-
- LOD_EdgeInd ed = (*edge_it);
- LOD_Edge & edge = edges[ed];//*edge_it];
-
- verts[edge.m_verts[0]].RemoveEdge(ed);
- verts[edge.m_verts[1]].RemoveEdge(ed);
- }
-
- // we postpone deletion of the internal edges untill the end
- // this is because deleting edges invalidates all of the
- // EdgeInd vectors above.
-
-
- // now untie all the polygons in p_v0v1 from the edge ring
-
- // select all polygons in p_v0v1
-
- face_it = p_v0v1.begin();
- face_end = p_v0v1.end();
-
- for (;face_it != face_end; ++face_it) {
- faces[*face_it].SetSelectTag(true);
- }
-
- edge_it = edge_ring.begin();
- edge_end = edge_ring.end();
-
- for (;edge_it != edge_end; ++edge_it) {
- LOD_Edge & edge = edges[*edge_it];
-
- // presumably all edges in edge_ring point to at least
- // one polygon from p_v0v1
-
- if (!edge.m_faces[0].IsEmpty() && faces[edge.m_faces[0]].SelectTag()) {
- edge.m_faces[0].Invalidate();
- }
-
- if (!edge.m_faces[1].IsEmpty() && faces[edge.m_faces[1]].SelectTag()) {
- edge.m_faces[1].Invalidate();
- }
- }
-
- // deselect the faces
-
- face_it = p_v0v1.begin();
- face_end = p_v0v1.end();
-
- for (;face_it != face_end; ++face_it) {
- faces[*face_it].SetSelectTag(false);
- }
-
- // perform the edge collapse
- ////////////////////////////
-
- // iterate through the polygons of p_v0 and replace the vertex
- // index v0 with v1
-
- face_it = p_v01[0].begin();
- face_end = p_v01[0].end();
-
- for (;face_it != face_end; ++face_it) {
- faces[*face_it].SwapVertex(v0_ind,v1_ind);
- }
-
- face_it = p_v0v1.begin();
- face_end = p_v0v1.end();
-
- for (;face_it != face_end; ++face_it) {
- if (faces[*face_it].Degenerate()) {
- degenerate_faces.push_back(*face_it);
- } else {
- update_faces.push_back(*face_it);
- }
- }
-
- // Add all the non-degenerate faces back into the
- // mesh. Get a record of the new edges created in
- // this process.
-
- face_it = update_faces.begin();
- face_end = update_faces.end();
-
- for (;face_it != face_end; ++face_it) {
- mesh.ConnectTriangle(*face_it,new_edges);
- }
-
- // degenerate ring primitives
- /////////////////////////////
-
- // we now need to examine each of the edges on the ring
- // and work out if they are degenerate - if so we attempt
- // to delete them -> add them to the other edges to delete
- // in e_v0v1
-
- edge_it = edge_ring.begin();
- edge_end = edge_ring.end();
-
- for (;edge_it != edge_end; ++edge_it) {
- if (edges[*edge_it].Degenerate()) {
- degenerate_edges.push_back(*edge_it);
- }
- }
-
- // do the same for the ring vertices.
-
- vector<LOD_VertexInd>::iterator vertex_it = vertex_ring.begin();
- vector<LOD_VertexInd>::const_iterator vertex_end = vertex_ring.end();
-
- for (;vertex_it != vertex_end; ++vertex_it) {
- if (verts[*vertex_it].Degenerate()) {
- degenerate_vertices.push_back(*vertex_it);
- } else {
- update_vertices.push_back(*vertex_it);
- }
- }
-
- // we now know all the degenerate primitives
- // and the new primitives we have inserted into the mesh
-
- // We now delete the mesh primitives, mesh.DeleteXXXXXX() methods
- // assume that the index vectors are sorted into descending order.
- // we do that now.
-
- sort(degenerate_edges.begin(),degenerate_edges.end(),LOD_EdgeInd::greater());
- sort(degenerate_faces.begin(),degenerate_faces.end(),LOD_FaceInd::greater());
- sort(degenerate_vertices.begin(),degenerate_vertices.end(),LOD_VertexInd::greater());
-
-
- return true;
-
-}
-
-LOD_EdgeCollapser::
-LOD_EdgeCollapser(
-){
- // nothing to do
-}
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.h b/intern/decimation/intern/LOD_EdgeCollapser.h
deleted file mode 100644
index 75a8b70f672..00000000000
--- a/intern/decimation/intern/LOD_EdgeCollapser.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_EdgeCollapser.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_EDGECOLLAPSER_H__
-#define __LOD_EDGECOLLAPSER_H__
-
-// This is a helper class that collapses edges of a 2 - manifold mesh.
-
-#include "LOD_MeshPrimitives.h"
-#include "MEM_NonCopyable.h"
-#include <vector>
-#include <functional>
-
-class LOD_ManMesh2;
-
-class LOD_EdgeCollapser
-: public MEM_NonCopyable
-{
-
-public :
-
- static
- LOD_EdgeCollapser *
- New(
- );
-
- // returns via arguments the set of modified
- // verts,edges and faces.
-
- bool
- CollapseEdge(
- LOD_EdgeInd ei,
- LOD_ManMesh2 &mesh,
- std::vector<LOD_EdgeInd> & degenerate_edges,
- std::vector<LOD_FaceInd> & degenerate_faces,
- std::vector<LOD_VertexInd> & degenerate_vertices,
- std::vector<LOD_EdgeInd> & new_edges,
- std::vector<LOD_FaceInd> & update_faces,
- std::vector<LOD_VertexInd> & update_vertices
- );
-
-private :
-
- LOD_EdgeCollapser(
- );
-
- // Test to see if the result of collapsing the
- // edge produces 2 junctions in the mesh i.e. where
- // an edge is shared by more than 2 polygons
-
- // We count the number of coincedent edge pairs that
- // result from the collapse of collapse_edge.
-
- // If collapse edge is a boundary edge then the number of
- // coincedent pairs should be 1
- // else it should be 2.
-
- bool
- TJunctionTest(
- LOD_ManMesh2 &mesh,
- std::vector<LOD_EdgeInd> &e_v0v1,
- LOD_EdgeInd collapse_edge
- );
-
- // here's the definition of the sort function
- // we use to determine coincedent edges
-
- // assumes the edges are normalized i.e. m_verts[0] <= m_verts[1]
-
- struct less : std::binary_function<LOD_Edge, LOD_Edge, bool> {
- bool
- operator()(
- const LOD_Edge& a,
- const LOD_Edge& b
- ) const {
-
- if (int(a.m_verts[0]) == int(b.m_verts[0])) {
- return (int(a.m_verts[1]) < int(b.m_verts[1]));
- } else {
- return (int(a.m_verts[0]) < int(b.m_verts[0]));
- }
- }
- };
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ExternBufferEditor.h b/intern/decimation/intern/LOD_ExternBufferEditor.h
deleted file mode 100644
index c903b255812..00000000000
--- a/intern/decimation/intern/LOD_ExternBufferEditor.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternBufferEditor.h
- * \ingroup decimation
- */
-
-
-/**
-
- * Copyright (C) 2001 NaN Technologies B.V.
- */
-
-#ifndef __LOD_EXTERNBUFFEREDITOR_H__
-#define __LOD_EXTERNBUFFEREDITOR_H__
-
-#include "LOD_MeshPrimitives.h"
-#include <vector>
-#include "LOD_ManMesh2.h"
-#include "../extern/LOD_decimation.h"
-
-
-// This class syncs external vertex/face buffers
-// with the internal mesh representation during
-// decimation.
-
-class LOD_ExternBufferEditor
-{
-
-public :
-
- static
- LOD_ExternBufferEditor *
- New(
- LOD_Decimation_InfoPtr extern_info
- ){
- if (extern_info == NULL) return NULL;
- return new LOD_ExternBufferEditor(extern_info);
- }
-
- // update the external vertex buffer with vertices
- // from the mesh
-
- void
- CopyModifiedVerts(
- LOD_ManMesh2 & mesh,
- const std::vector<LOD_VertexInd> & mod_vertices
- ){
-
- std::vector<LOD_VertexInd>::const_iterator v_start = mod_vertices.begin();
- std::vector<LOD_VertexInd>::const_iterator v_end = mod_vertices.end();
-
- std::vector<LOD_Vertex> & mesh_verts = mesh.VertexSet();
-
- float * const extern_vertex_ptr = m_extern_info->vertex_buffer;
-
- for (; v_start != v_end; ++v_start) {
- float * mod_vert = extern_vertex_ptr + int(*v_start)*3;
- mesh_verts[*v_start].CopyPosition(mod_vert);
- }
- }
-
- // update the external face buffer with faces from the mesh
-
- void
- CopyModifiedFaces(
- LOD_ManMesh2 & mesh,
- const std::vector<LOD_FaceInd> & mod_faces
- ){
-
- std::vector<LOD_FaceInd>::const_iterator f_start = mod_faces.begin();
- std::vector<LOD_FaceInd>::const_iterator f_end = mod_faces.end();
-
- std::vector<LOD_TriFace> &mesh_faces = mesh.FaceSet();
-
- int * const extern_face_ptr = m_extern_info->triangle_index_buffer;
-
- for (; f_start != f_end; ++f_start) {
- int *mod_face = extern_face_ptr + 3*int(*f_start);
- mesh_faces[*f_start].CopyVerts(mod_face);
- }
- }
-
-
- // Copy the last vertex over the vertex specified by
- // vi. Decrement the size of the vertex array
-
- void
- CopyBackVertex(
- LOD_VertexInd vi
- ){
-
- float * const extern_vertex_ptr = m_extern_info->vertex_buffer;
- int * extern_vertex_num = &(m_extern_info->vertex_num);
-
- float * last_external_vert = extern_vertex_ptr + 3*((*extern_vertex_num) - 1);
- float * external_vert = extern_vertex_ptr + 3*int(vi);
-
- external_vert[0] = last_external_vert[0];
- external_vert[1] = last_external_vert[1];
- external_vert[2] = last_external_vert[2];
-
- *extern_vertex_num -=1;
- }
-
- // Copy the last face over the face specified by fi
- // Decrement the size of the face array
-
- void
- CopyBackFace(
- LOD_FaceInd fi
- ) {
- int * const extern_face_ptr = m_extern_info->triangle_index_buffer;
- int * extern_face_num = &(m_extern_info->face_num);
-
- int * last_external_face = extern_face_ptr + 3*((*extern_face_num) -1);
- int * external_face = extern_face_ptr + 3*int(fi);
- external_face[0] = last_external_face[0];
- external_face[1] = last_external_face[1];
- external_face[2] = last_external_face[2];
-
- *extern_face_num -=1;
- }
-
-
-private :
-
- LOD_ExternBufferEditor(
- LOD_Decimation_InfoPtr extern_info
- ) :
- m_extern_info (extern_info)
- {
- }
-
- LOD_Decimation_InfoPtr const m_extern_info;
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.cpp b/intern/decimation/intern/LOD_ExternNormalEditor.cpp
deleted file mode 100644
index 90033fe672b..00000000000
--- a/intern/decimation/intern/LOD_ExternNormalEditor.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternNormalEditor.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_ExternNormalEditor.h"
-#include <vector>
-
-using namespace std;
-
-
-LOD_ExternNormalEditor::
-LOD_ExternNormalEditor(
- LOD_Decimation_InfoPtr extern_info,
- LOD_ManMesh2 &mesh
-) :
- m_mesh(mesh),
- m_extern_info (extern_info)
-{
-}
-
- LOD_ExternNormalEditor *
-LOD_ExternNormalEditor::
-New(
- LOD_Decimation_InfoPtr extern_info,
- LOD_ManMesh2 &mesh
-){
- if (extern_info == NULL) return NULL;
-
- MEM_SmartPtr<LOD_ExternNormalEditor> output(new LOD_ExternNormalEditor(extern_info,mesh));
-
- int face_num = mesh.FaceSet().size();
-
- MEM_SmartPtr<vector<MT_Vector3> > normals(new vector<MT_Vector3>);
-
- if (output == NULL ||
- normals == NULL
- ) {
- return NULL;
- }
-
- normals->reserve(face_num);
- output->m_normals = normals.Release();
-
- return output.Release();
-};
-
-
- void
-LOD_ExternNormalEditor::
-Remove(
- std::vector<LOD_FaceInd> &sorted_faces
-){
- // assumes a collection of faces sorted in descending order .
-
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
- vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
- for (; it_start != it_end; ++it_start) {
-
- if (normals.size() > 0) {
- MT_Vector3 temp = normals[*it_start];
-
- normals[*it_start] = normals.back();
- normals.back() = temp;
-
- normals.pop_back();
- }
-
- // FIXME - throw exception
- }
-}
-
-
- void
-LOD_ExternNormalEditor::
-Add(
-){
- MT_Vector3 zero(0.0f,0.0f,0.0f);
- m_normals->push_back(zero);
-};
-
- void
-LOD_ExternNormalEditor::
-Update(
- std::vector<LOD_FaceInd> &sorted_faces
-){
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
- vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
- const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-
- for (; it_start != it_end; ++it_start) {
- normals[*it_start] = ComputeNormal(faces[*it_start]);
- }
-};
-
-
-
-
-// vertex normals
-/////////////////
-
- void
-LOD_ExternNormalEditor::
-RemoveVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
-){
-
- float * vertex_normals = m_extern_info->vertex_normal_buffer;
-
- // assumption here that the vertexs normal number corresponds with
- // the number of vertices !
-
- int vertex_normal_num = m_extern_info->vertex_num;
-
- vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
- vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
- for (; it_start != it_end; ++it_start) {
-
- if (vertex_normal_num > 0) {
- float * vertex_normal = vertex_normals + int(*it_start)*3;
- float * last_vertex = vertex_normals + ((vertex_normal_num-1)*3);
-
- MT_Vector3 last_v(last_vertex);
- last_v.getValue(vertex_normal);
- vertex_normal_num--;
- }
-
- // FIXME - through exception
- }
-};
-
-
-
- void
-LOD_ExternNormalEditor::
-UpdateVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
-){
- float * vertex_normals = m_extern_info->vertex_normal_buffer;
-
- vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
- vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
- for (; it_start != it_end; ++it_start) {
- MT_Vector3 temp = ComputeVertexNormal(*it_start);
- float * vertex_normal = vertex_normals + int(*it_start)*3;
- temp.getValue(vertex_normal);
- }
-}
-
-// Editor specific methods
-//////////////////////////
-
- void
-LOD_ExternNormalEditor::
-BuildNormals(
-) {
- const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- int face_num = faces.size();
- int cur_face = 0;
-
- for (; cur_face < face_num; ++cur_face) {
-
- MT_Vector3 new_normal = ComputeNormal(faces[cur_face]);
- normals.push_back(new_normal);
- }
-}
-
-const
- MT_Vector3
-LOD_ExternNormalEditor::
-ComputeNormal(
- const LOD_TriFace &face
-) const {
-
- const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
- MT_Vector3 vec1 =
- verts[face.m_verts[1]].pos -
- verts[face.m_verts[0]].pos;
-
- MT_Vector3 vec2 =
- verts[face.m_verts[2]].pos -
- verts[face.m_verts[1]].pos;
-
- vec1 = vec1.cross(vec2);
-
- if (!vec1.fuzzyZero()) {
- vec1.normalize();
- return (vec1);
- } else {
- return (MT_Vector3(1.0,0,0));
- }
-}
-
-const
- MT_Vector3
-LOD_ExternNormalEditor::
-ComputeVertexNormal(
- const LOD_VertexInd v
-) const {
-
- // average the face normals surrounding this
- // vertex and normalize
- // vector<LOD_Vertex> &verts = m_mesh.VertexSet(); /*unused*/
- const vector<MT_Vector3> & face_normals = m_normals.Ref();
-
- vector<LOD_FaceInd> vertex_faces;
- vertex_faces.reserve(32);
-
- m_mesh.VertexFaces(v,vertex_faces);
-
- MT_Vector3 normal(0,0,0);
-
- vector<LOD_FaceInd>::const_iterator face_it = vertex_faces.begin();
- vector<LOD_FaceInd>::const_iterator face_end = vertex_faces.end();
-
- for (; face_it != face_end; ++face_it) {
- normal += face_normals[*face_it];
- }
-
- if (!normal.fuzzyZero()) {
- normal.normalize();
- return (normal);
- } else {
- return (MT_Vector3(1.0,0,0));
- }
-}
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.h b/intern/decimation/intern/LOD_ExternNormalEditor.h
deleted file mode 100644
index 52135196dc5..00000000000
--- a/intern/decimation/intern/LOD_ExternNormalEditor.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ExternNormalEditor.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_EXTERNNORMALEDITOR_H__
-#define __LOD_EXTERNNORMALEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "../extern/LOD_decimation.h"
-
-class LOD_ExternNormalEditor : public MEM_NonCopyable
-{
-
-public :
-
- // Creation
- ///////////
-
- static
- LOD_ExternNormalEditor *
- New(
- LOD_Decimation_InfoPtr,
- LOD_ManMesh2 &mesh
- );
-
- // Property editor interface
- ////////////////////////////
-
-
- // Faces
- ////////
- void
- Remove(
- std::vector<LOD_FaceInd> &sorted_faces
- );
-
- void
- Add(
- );
-
- void
- Update(
- std::vector<LOD_FaceInd> &sorted_faces
- );
-
- const
- std::vector<MT_Vector3> &
- Normals(
- ) const {
- return m_normals.Ref();
- };
-
-
- // vertex normals
- /////////////////
-
- void
- RemoveVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
- );
-
-
- void
- UpdateVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
- );
-
- // Editor specific methods
- //////////////////////////
-
- void
- BuildNormals(
- );
-
-
-private :
-
- MEM_SmartPtr<std::vector<MT_Vector3> > m_normals;
-
- LOD_ManMesh2 &m_mesh;
- LOD_Decimation_InfoPtr m_extern_info;
-
-private :
-
-
- LOD_ExternNormalEditor(
- LOD_Decimation_InfoPtr extern_info,
- LOD_ManMesh2 &mesh
- );
-
- const
- MT_Vector3
- ComputeNormal(
- const LOD_TriFace &face
- ) const;
-
- const
- MT_Vector3
- ComputeVertexNormal (
- const LOD_VertexInd vi
- ) const;
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.cpp b/intern/decimation/intern/LOD_FaceNormalEditor.cpp
deleted file mode 100644
index 430406a6d63..00000000000
--- a/intern/decimation/intern/LOD_FaceNormalEditor.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_FaceNormalEditor.cpp
- * \ingroup decimation
- */
-
-
-// implementation of LOD_FaceNormalEditor.h
-
-///////////////////////////////////////
-#include "LOD_FaceNormalEditor.h"
-
-using namespace std;
-
-LOD_FaceNormalEditor::
-LOD_FaceNormalEditor(
- LOD_ManMesh2 & mesh
-) : m_mesh(mesh) {
-};
-
- LOD_FaceNormalEditor *
-LOD_FaceNormalEditor::
-New(
- LOD_ManMesh2 &mesh
-){
- // build a set of normals of the same size
- // as the number of polys in the mesh
-
- MEM_SmartPtr<LOD_FaceNormalEditor> output(new LOD_FaceNormalEditor(mesh));
-
- int face_num = mesh.FaceSet().size();
-
- MEM_SmartPtr<vector<MT_Vector3> > normals(new vector<MT_Vector3>);
- MEM_SmartPtr<vector<MT_Vector3> > vertex_normals(new vector<MT_Vector3>);
-
- if (output == NULL ||
- normals == NULL
- ) {
- return NULL;
- }
-
- normals->reserve(face_num);
- vertex_normals->reserve(mesh.VertexSet().size());
- output->m_normals = normals.Release();
- output->m_vertex_normals = vertex_normals.Release();
-
- return output.Release();
-};
-
-
-// Property editor interface
-////////////////////////////
-
- void
-LOD_FaceNormalEditor::
-Remove(
- std::vector<LOD_FaceInd> &sorted_faces
-){
-
- // assumes a collection of faces sorted in descending order .
-
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
- vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
- for (; it_start != it_end; ++it_start) {
-
- if (normals.size() > 0) {
- MT_Vector3 temp = normals[*it_start];
-
- normals[*it_start] = normals.back();
- normals.back() = temp;
-
- normals.pop_back();
- }
-
- // FIXME - through exception
- }
-}
-
-
- void
-LOD_FaceNormalEditor::
-Add(
-){
- MT_Vector3 zero(0.0f,0.0f,0.0f);
- m_normals->push_back(zero);
-}
-
- void
-LOD_FaceNormalEditor::
-Update(
- std::vector<LOD_FaceInd> &sorted_faces
-){
-
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- vector<LOD_FaceInd>::const_iterator it_start = sorted_faces.begin();
- vector<LOD_FaceInd>::const_iterator it_end = sorted_faces.end();
-
- const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
-
- for (; it_start != it_end; ++it_start) {
- normals[*it_start] = ComputeNormal(faces[*it_start]);
- }
-};
-
-// vertex normals
-/////////////////
-
-
- void
-LOD_FaceNormalEditor::
-RemoveVertexNormals(
- vector<LOD_VertexInd> &sorted_verts
-){
- vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
-
- vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
- vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
- for (; it_start != it_end; ++it_start) {
-
- if (vertex_normals.size() > 0) {
- MT_Vector3 temp = vertex_normals[*it_start];
-
- vertex_normals[*it_start] = vertex_normals.back();
- vertex_normals.back() = temp;
-
- vertex_normals.pop_back();
- }
-
- // FIXME - through exception
- }
-};
-
- void
-LOD_FaceNormalEditor::
-UpdateVertexNormals(
- vector<LOD_VertexInd> &sorted_verts
-){
- vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
-
- vector<LOD_VertexInd>::const_iterator it_start = sorted_verts.begin();
- vector<LOD_VertexInd>::const_iterator it_end = sorted_verts.end();
-
- for (; it_start != it_end; ++it_start) {
- vertex_normals[*it_start] = ComputeVertexNormal(*it_start);
- }
-}
-
-
-
-// Editor specific methods
-//////////////////////////
-
- void
-LOD_FaceNormalEditor::
-BuildNormals(
-){
-
- const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
- vector<MT_Vector3> & normals = m_normals.Ref();
-
- int face_num = faces.size();
- int cur_face = 0;
-
- for (; cur_face < face_num; ++cur_face) {
-
- MT_Vector3 new_normal = ComputeNormal(faces[cur_face]);
- normals.push_back(new_normal);
- }
- // now build the vertex normals
-
- vector<MT_Vector3> & vertex_normals = m_vertex_normals.Ref();
- const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
- int vertex_num = verts.size();
- int cur_vertex = 0;
-
- for (; cur_vertex < vertex_num; ++cur_vertex) {
- MT_Vector3 new_normal = ComputeVertexNormal(cur_vertex);
- vertex_normals.push_back(new_normal);
- }
-}
-
-const
- MT_Vector3
-LOD_FaceNormalEditor::
-ComputeNormal(
- const LOD_TriFace &face
-) const {
-
- const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
- MT_Vector3 vec1 =
- verts[face.m_verts[1]].pos -
- verts[face.m_verts[0]].pos;
-
- MT_Vector3 vec2 =
- verts[face.m_verts[2]].pos -
- verts[face.m_verts[1]].pos;
-
- vec1 = vec1.cross(vec2);
-
- if (!vec1.fuzzyZero()) {
- vec1.normalize();
- return (vec1);
- } else {
- return (MT_Vector3(1.0,0,0));
- }
-}
-
-const
- MT_Vector3
-LOD_FaceNormalEditor::
-ComputeVertexNormal(
- const LOD_VertexInd v
-) const {
-
- // average the face normals surrounding this
- // vertex and normalize
- const vector<MT_Vector3> & face_normals = m_normals.Ref();
-
- vector<LOD_FaceInd> vertex_faces;
- vertex_faces.reserve(32);
-
- m_mesh.VertexFaces(v,vertex_faces);
-
- MT_Vector3 normal(0,0,0);
-
- vector<LOD_FaceInd>::const_iterator face_it = vertex_faces.begin();
- vector<LOD_FaceInd>::const_iterator face_end = vertex_faces.end();
-
- for (; face_it != face_end; ++face_it) {
- normal += face_normals[*face_it];
- }
-
- if (!normal.fuzzyZero()) {
- normal.normalize();
- return (normal);
- } else {
- return (MT_Vector3(1.0,0,0));
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.h b/intern/decimation/intern/LOD_FaceNormalEditor.h
deleted file mode 100644
index a221ab0bd7a..00000000000
--- a/intern/decimation/intern/LOD_FaceNormalEditor.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_FaceNormalEditor.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_FACENORMALEDITOR_H__
-#define __LOD_FACENORMALEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-
-
-class LOD_FaceNormalEditor : public MEM_NonCopyable
-{
-
-public :
-
- // Creation
- ///////////
-
- static
- LOD_FaceNormalEditor *
- New(
- LOD_ManMesh2 &mesh
- );
-
- // Property editor interface
- ////////////////////////////
-
-
- // Faces
- ////////
- void
- Remove(
- std::vector<LOD_FaceInd> &sorted_faces
- );
-
- void
- Add(
- );
-
- void
- Update(
- std::vector<LOD_FaceInd> &sorted_faces
- );
-
-
- // vertex normals
- /////////////////
-
- void
- RemoveVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
- );
-
-
- void
- UpdateVertexNormals(
- std::vector<LOD_VertexInd> &sorted_verts
- );
-
-
-
- const
- std::vector<MT_Vector3> &
- Normals(
- ) const {
- return m_normals.Ref();
- };
-
-
- const
- std::vector<MT_Vector3> &
- VertexNormals(
- ) const {
- return m_vertex_normals.Ref();
- };
-
- // Editor specific methods
- //////////////////////////
-
- void
- BuildNormals(
- );
-
-
-private :
-
- MEM_SmartPtr<std::vector<MT_Vector3> > m_normals;
- MEM_SmartPtr<std::vector<MT_Vector3> > m_vertex_normals;
-
- LOD_ManMesh2 &m_mesh;
-
-private :
-
-
- LOD_FaceNormalEditor(LOD_ManMesh2 &mesh);
-
- const
- MT_Vector3
- ComputeNormal(
- const LOD_TriFace &face
- ) const;
-
- const
- MT_Vector3
- ComputeVertexNormal (
- const LOD_VertexInd vi
- ) const;
-
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_ManMesh2.cpp b/intern/decimation/intern/LOD_ManMesh2.cpp
deleted file mode 100644
index c618944162f..00000000000
--- a/intern/decimation/intern/LOD_ManMesh2.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ManMesh2.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_ManMesh2.h"
-
-#include "MT_assert.h"
-#include <algorithm>
-#include "LOD_MeshException.h"
-#include "CTR_TaggedSetOps.h"
-#include "CTR_UHeap.h"
-#include "LOD_ExternBufferEditor.h"
-
-
-using namespace std;
-
-LOD_ManMesh2::
-LOD_ManMesh2(
-) :
- m_bbox_min(0,0,0),
- m_bbox_max(0,0,0)
-{
-}
-
-
- LOD_ManMesh2 *
-LOD_ManMesh2::
-New(
-){
- MEM_SmartPtr<LOD_ManMesh2> output(new LOD_ManMesh2());
- if (output == NULL) return NULL;
-
- // build the vertex, edge and face sets.
-
- MEM_SmartPtr<vector<LOD_Vertex> > verts(new vector<LOD_Vertex>);
- MEM_SmartPtr<vector<LOD_TriFace> > faces(new vector<LOD_TriFace>);
- MEM_SmartPtr<vector<LOD_Edge> > edges(new vector<LOD_Edge>);
-
- if ((faces == NULL) || (edges == NULL) || (verts == NULL)) {
- return NULL;
- }
-
- output->m_verts = verts.Release();
- output->m_faces = faces.Release();
- output->m_edges = edges.Release();
-
- return output.Release();
-}
-
-// take ownership of the vertices.
-
- bool
-LOD_ManMesh2::
-SetVertices(
- MEM_SmartPtr<vector<LOD_Vertex> > verts
-){
-
-
- // take ownership of vertices
- m_verts = verts;
-
- // create a polygon and edge buffer of half the size
- // and just use the automatic resizing feature of vector<>
- // to worry about the dynamic array resizing
-
- m_faces->clear();
- m_edges->clear();
-
- m_faces->reserve(m_verts->size()/2);
- m_edges->reserve(m_verts->size()/2);
-
- return true;
-
-}
-
-
-// add a triangle to the mesh
-
- void
-LOD_ManMesh2::
-AddTriangle(
- int verts[3]
-) {
-
- MT_assert(verts[0] < int(m_verts->size()));
- MT_assert(verts[1] < int(m_verts->size()));
- MT_assert(verts[2] < int(m_verts->size()));
-
- LOD_TriFace face;
- face.m_verts[0] = verts[0];
- face.m_verts[1] = verts[1];
- face.m_verts[2] = verts[2];
-
- LOD_FaceInd face_index = m_faces->size();
-
- m_faces->push_back(face);
-
- // now work out if any of the directed edges or their
- // companion edges exist already.
- // We go through the edges associated with each of the given vertices
-
- // the safest thing to do is iterate through each of the edge sets
- // check against each of the 2 other triangle edges to see if they are there
-
- vector<LOD_EdgeInd> new_edges;
- new_edges.reserve(3);
-
- InsertEdge(verts[0],verts[1],face_index,new_edges);
- InsertEdge(verts[1],verts[2],face_index,new_edges);
- InsertEdge(verts[2],verts[0],face_index,new_edges);
-
-}
-
-// Adds the index of any created edges to new_edges
-
- bool
-LOD_ManMesh2::
-InsertEdge(
- const LOD_VertexInd v1,
- const LOD_VertexInd v2,
- const LOD_FaceInd f,
- vector<LOD_EdgeInd> &new_edges
-){
-
- MT_assert(!v1.IsEmpty());
- MT_assert(!v2.IsEmpty());
- MT_assert(!f.IsEmpty());
-
- vector<LOD_Vertex> &verts = VertexSet();
- vector<LOD_Edge> &edges = EdgeSet();
-
- LOD_EdgeInd e;
-
- e = FindEdge(v1,v2);
-
- if (e.IsEmpty()) {
- // This edge does not exist -- make a new one
-
- LOD_Edge temp_e;
- temp_e.m_verts[0] = v1;
- temp_e.m_verts[1] = v2;
-
- e = m_edges->size();
-
- // set the face ptr for this half-edge
- temp_e.m_faces[0] = f;
-
- m_edges->push_back(temp_e);
-
- // add the edge index to it's vertices
-
- verts[v1].AddEdge(e);
- verts[v2].AddEdge(e);
-
- new_edges.push_back(e);
-
- } else {
-
- // edge already exists
- // insure that there is no polygon already
- // attached to the other side of this edge
-
- // swap the empty face pointer in edge with f
-
- LOD_Edge &edge = edges[e];
-
- edge.SwapFace(LOD_FaceInd::Empty(),f);
- }
-
-
- return true;
-
-}
-
- void
-LOD_ManMesh2::
-ConnectTriangle(
- LOD_FaceInd fi,
- std::vector<LOD_EdgeInd> & new_edges
-){
-
- vector<LOD_TriFace> &faces = FaceSet();
-
- MT_assert(!faces[fi].Degenerate());
-
- LOD_TriFace & face = faces[fi];
-
- InsertEdge(face.m_verts[0],face.m_verts[1],fi,new_edges);
- InsertEdge(face.m_verts[1],face.m_verts[2],fi,new_edges);
- InsertEdge(face.m_verts[2],face.m_verts[0],fi,new_edges);
-};
-
-
-
-
-// geometry access
-//////////////////
-
- vector<LOD_Vertex> &
-LOD_ManMesh2::
-VertexSet(
-) const {
- return m_verts.Ref();
-}
-
- vector<LOD_TriFace> &
-LOD_ManMesh2::
-FaceSet(
-) const {
- return m_faces.Ref();
-}
-
- vector<LOD_Edge> &
-LOD_ManMesh2::
-EdgeSet(
-) const {
- return m_edges.Ref();
-};
-
-LOD_ManMesh2::
-~LOD_ManMesh2(
-){
- //auto ptr takes care of vertex arrays etc.
-}
-
- LOD_EdgeInd
-LOD_ManMesh2::
-FindEdge(
- const LOD_VertexInd v1,
- const LOD_VertexInd v2
-) {
-
- vector<LOD_Vertex> &verts = VertexSet();
- vector<LOD_Edge> &edges = EdgeSet();
-
- LOD_Edge e;
- e.m_verts[0] = v1;
- e.m_verts[1] = v2;
-
- vector<LOD_EdgeInd> &v1_edges = verts[v1].m_edges;
- vector<LOD_EdgeInd>::const_iterator v1_end = v1_edges.end();
- vector<LOD_EdgeInd>::iterator v1_begin = v1_edges.begin();
-
- for (; v1_begin != v1_end; ++v1_begin) {
- if (edges[*v1_begin] == e) return *v1_begin;
- }
-
- return LOD_EdgeInd::Empty();
-}
-
-// face queries
-///////////////
-
- void
-LOD_ManMesh2::
-FaceVertices(
- LOD_FaceInd fi,
- vector<LOD_VertexInd> &output
-){
- const vector<LOD_TriFace> &faces = FaceSet();
- const LOD_TriFace & f = faces[fi];
-
- output.push_back(f.m_verts[0]);
- output.push_back(f.m_verts[1]);
- output.push_back(f.m_verts[2]);
-}
-
- void
-LOD_ManMesh2::
-FaceEdges(
- LOD_FaceInd fi,
- vector<LOD_EdgeInd> &output
-){
- const vector<LOD_TriFace> &faces = FaceSet();
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_Vertex> &verts = VertexSet();
-
- const LOD_TriFace & f = faces[fi];
- // intersect vertex edges
-
- vector<LOD_EdgeInd> & v0_edges = verts[f.m_verts[0]].m_edges;
- vector<LOD_EdgeInd> & v1_edges = verts[f.m_verts[1]].m_edges;
- vector<LOD_EdgeInd> & v2_edges = verts[f.m_verts[2]].m_edges;
-
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v0_edges,v1_edges,edges,output);
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v1_edges,v2_edges,edges,output);
- CTR_TaggedSetOps<LOD_EdgeInd,LOD_Edge>::IntersectPair(v2_edges,v0_edges,edges,output);
-
- MT_assert(output.size() == 3);
- if (output.size() != 3) {
- LOD_MeshException e(LOD_MeshException::e_non_manifold);
- throw(e);
- }
-}
-
-
-// edge queries
-///////////////
-
- void
-LOD_ManMesh2::
-EdgeVertices(
- LOD_EdgeInd ei,
- vector<LOD_VertexInd> &output
-){
- const vector<LOD_Edge> &edges = EdgeSet();
- const LOD_Edge & e = edges[ei];
-
- output.push_back(e.m_verts[0]);
- output.push_back(e.m_verts[1]);
-}
-
- void
-LOD_ManMesh2::
-EdgeFaces(
- LOD_EdgeInd ei,
- vector<LOD_FaceInd> &output
-){
- const vector<LOD_Edge> &edges = EdgeSet();
- const LOD_Edge & e = edges[ei];
-
- if (!e.m_faces[0].IsEmpty()) {
- output.push_back(e.m_faces[0]);
- }
- if (!e.m_faces[1].IsEmpty()) {
- output.push_back(e.m_faces[1]);
- }
-}
-
-// vertex queries
-/////////////////
-
- void
-LOD_ManMesh2::
-VertexEdges(
- LOD_VertexInd vi,
- vector<LOD_EdgeInd> &output
-){
- // iterate through the edges of v and push them onto the
- // output
-
- vector<LOD_Vertex> &verts = VertexSet();
-
- vector<LOD_EdgeInd> & v_edges = verts[vi].m_edges;
- vector<LOD_EdgeInd>::iterator v_it = v_edges.begin();
-
- for (; v_it != v_edges.end(); ++v_it) {
- output.push_back(*v_it);
- }
-}
-
- void
-LOD_ManMesh2::
-VertexFaces(
- LOD_VertexInd vi,
- vector<LOD_FaceInd> &output
-){
- const vector<LOD_Vertex> &verts = VertexSet();
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_TriFace> &faces = FaceSet();
-
- const vector<LOD_EdgeInd> &v_edges = verts[vi].m_edges;
- vector<LOD_EdgeInd>::const_iterator e_it = v_edges.begin();
-
- for (; e_it != v_edges.end(); ++e_it) {
-
- LOD_Edge &e = edges[*e_it];
-
- if ((!e.m_faces[0].IsEmpty()) && (!faces[e.m_faces[0]].SelectTag())) {
- output.push_back(e.m_faces[0]);
- faces[e.m_faces[0]].SetSelectTag(true);
- }
-
- if ((!e.m_faces[1].IsEmpty()) && (!faces[e.m_faces[1]].SelectTag())) {
- output.push_back(e.m_faces[1]);
- faces[e.m_faces[1]].SetSelectTag(true);
- }
- }
-
- vector<LOD_FaceInd>::iterator f_it = output.begin();
-
- for (; f_it != output.end(); ++f_it) {
- faces[*f_it].SetSelectTag(false);
- }
-};
-
- void
-LOD_ManMesh2::
-SetBBox(
- MT_Vector3 bbox_min,
- MT_Vector3 bbox_max
-){
- m_bbox_min = bbox_min;
- m_bbox_max = bbox_max;
-};
-
- void
-LOD_ManMesh2::
-SC_TriFace(
- LOD_FaceInd f
-){
- LOD_TriFace face = (*m_faces)[f];
-
- // check for unique vertices
-
- if (
- (face.m_verts[0] == face.m_verts[1]) ||
- (face.m_verts[1] == face.m_verts[2]) ||
- (face.m_verts[2] == face.m_verts[0])
- ) {
- MT_assert(false);
- }
-
-}
-
-
- void
-LOD_ManMesh2::
-SC_EdgeList(
- LOD_VertexInd v
-){
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_Vertex> &verts = VertexSet();
-
- vector<LOD_EdgeInd>::iterator e_it = verts[v].m_edges.begin();
-
- for (;e_it != verts[v].m_edges.end(); ++e_it) {
- MT_assert( (edges[*e_it].m_verts[0] == v) || (edges[*e_it].m_verts[1] == v));
- }
-
-};
-
- void
-LOD_ManMesh2::
-DeleteVertex(
- LOD_ExternBufferEditor & extern_editor,
- LOD_VertexInd v
-){
-
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_Vertex> &verts = VertexSet();
- vector<LOD_TriFace> &faces = FaceSet();
-
- // need to update all the edge and polygons pointing to
- // the last vertex in m_verts
-
- if (verts.size() == 1) {
- verts.clear();
- return;
- }
-
- LOD_VertexInd last = LOD_VertexInd(size_t(verts.end() - verts.begin() - 1));
-
- if (!(last == v)) {
-
- // we asume that v is already disconnected
-
- vector<LOD_FaceInd> v_faces;
- vector<LOD_EdgeInd> v_edges;
-
- v_faces.reserve(64);
- v_edges.reserve(64);
-
- VertexFaces(last,v_faces);
- VertexEdges(last,v_edges);
-
- // map the faces and edges to look at v
-
- vector<LOD_FaceInd>::iterator face_it = v_faces.begin();
-
- for(; face_it != v_faces.end(); ++face_it) {
- faces[*face_it].SwapVertex(last,v);
- }
- vector<LOD_EdgeInd>::iterator edge_it = v_edges.begin();
-
- for (; edge_it != v_edges.end(); ++edge_it) {
- edges[*edge_it].SwapVertex(last,v);
- }
-
- // copy the last vertex onto v and pop off the back.
-
- verts[v] = verts[last];
-
- // tidy external buffer
- extern_editor.CopyModifiedFaces(*this,v_faces);
- }
-
- verts.pop_back();
- extern_editor.CopyBackVertex(v);
-
-
-};
-
- void
-LOD_ManMesh2::
-DeleteEdge(
- LOD_EdgeInd e,
- CTR_UHeap<LOD_Edge> * heap
-){
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_Vertex> &verts = VertexSet();
-
- if (edges.size() == 1) {
- edges.clear();
- return;
- }
-
- LOD_EdgeInd last = LOD_EdgeInd(size_t(edges.end() - edges.begin() - 1));
-
- if (!(last == e)) {
- vector<LOD_EdgeInd> e_verts;
- e_verts.reserve(2);
- EdgeVertices(last,e_verts);
- // something is wrong if there arent two!
-
- verts[e_verts[0]].SwapEdge(last,e);
- verts[e_verts[1]].SwapEdge(last,e);
-
- // edges[e] should already have been removed from the heap
-
- MT_assert(edges[e].HeapPos() == -1);
-
- edges[e] = edges[last];
- // also have to swap there heap positions.!!!!!
-
- heap->HeapVector()[edges[e].HeapPos()] = e;
-
-
- }
- edges.pop_back();
-};
-
- void
-LOD_ManMesh2::
-DeleteFace(
- LOD_ExternBufferEditor & extern_editor,
- LOD_FaceInd f
-){
-
- vector<LOD_Edge> &edges = EdgeSet();
- vector<LOD_TriFace> &faces = FaceSet();
-
- if (faces.size() == 1) {
- faces.clear();
- return;
- }
-
- LOD_FaceInd last = LOD_FaceInd(size_t (faces.end() - faces.begin() - 1));
-
- if (!(last == f)) {
-
- // we have to update the edges which point to the last
- // face
-
- vector<LOD_EdgeInd> f_edges;
- f_edges.reserve(3);
-
- FaceEdges(last,f_edges);
-
- vector<LOD_EdgeInd>::iterator edge_it = f_edges.begin();
- vector<LOD_EdgeInd>::const_iterator edge_end = f_edges.end();
-
- for (; edge_it != edge_end; ++edge_it) {
- edges[*edge_it].SwapFace(last,f);
- }
-
- faces[f] = faces[last];
-
- }
- faces.pop_back();
-
- // tidy external buffers
- extern_editor.CopyBackFace(f);
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_ManMesh2.h b/intern/decimation/intern/LOD_ManMesh2.h
deleted file mode 100644
index 5d4e1aff4e6..00000000000
--- a/intern/decimation/intern/LOD_ManMesh2.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_ManMesh2.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_MANMESH2_H__
-#define __LOD_MANMESH2_H__
-
-#include "LOD_MeshPrimitives.h"
-#include "MEM_SmartPtr.h"
-#include <vector>
-
-template <class HeapType> class CTR_UHeap;
-
-class LOD_ExternBufferEditor;
-
-class LOD_ManMesh2 // Manifold 2 dimensional mesh
-{
-
-public:
-
- static
- LOD_ManMesh2 *
- New(
- );
-
- // take ownership of the vertices.
-
- bool
- SetVertices(
- MEM_SmartPtr<std::vector<LOD_Vertex> > verts
- );
-
- // Add a triangle to the mesh
-
- void
- AddTriangle(
- int verts[3]
- );
-
- void
- ConnectTriangle(
- LOD_FaceInd fi,
- std::vector<LOD_EdgeInd> & new_edges
- );
-
- // geometry access
- //////////////////
-
- std::vector<LOD_Vertex> &
- VertexSet(
- ) const;
-
- std::vector<LOD_TriFace> &
- FaceSet(
- ) const;
-
- std::vector<LOD_Edge> &
- EdgeSet(
- ) const;
-
- ~LOD_ManMesh2(
- );
-
- // local geometry queries
- /////////////////////////
-
- // face queries
- ///////////////
-
- void
- FaceVertices(
- LOD_FaceInd f,
- std::vector<LOD_VertexInd> &output
- );
-
- void
- FaceEdges(
- LOD_FaceInd f,
- std::vector<LOD_EdgeInd> &output
- );
-
- // edge queries
- ///////////////
-
- void
- EdgeVertices(
- LOD_EdgeInd e,
- std::vector<LOD_VertexInd> &output
- );
-
- void
- EdgeFaces(
- LOD_EdgeInd e,
- std::vector<LOD_FaceInd> &output
- );
-
- // vertex queries
- /////////////////
-
- void
- VertexEdges(
- LOD_VertexInd v,
- std::vector<LOD_EdgeInd> &output
- );
-
- void
- VertexFaces(
- LOD_VertexInd v,
- std::vector<LOD_FaceInd> &output
- );
-
- void
- SetBBox(
- MT_Vector3 bbox_min,
- MT_Vector3 bbox_max
- );
-
- MT_Vector3
- BBoxMin(
- ) const {
- return m_bbox_min;
- };
-
- MT_Vector3
- BBoxMax(
- ) const {
- return m_bbox_max;
- };
-
- // Remove a primitive from the mesh
- ///////////////////////////////////
-
- // These methods assume you have correctly
- // tidied up the index pointers in other primitives,
- // so that nothing refers to this object any more
-
- // These methods exchange the primitive with the
- // last primitive in the vector. It modifies everything
- // pointing to the last primitive correctly.
-
- // FIXME refactor extern editor out of primitive deletion
- // insead return a vector of primitives that need to be
- // modified and do this externally
-
- void
- DeleteVertex(
- LOD_ExternBufferEditor & extern_editor,
- LOD_VertexInd v
- );
-
- void
- DeleteEdge(
- LOD_EdgeInd e,
- CTR_UHeap<LOD_Edge> *heap
- );
-
- void
- DeleteFace(
- LOD_ExternBufferEditor & extern_editor,
- LOD_FaceInd f
- );
-
- // Sanity Check routines
- ////////////////////////
-
- // Make sure the edge sets and the vertex sets are
- // consistent
-
- void
- SC_TriFace(
- LOD_FaceInd f
- );
-
- // basic sanity checking of an edge list bails out if there are more than 1024
- // edges
-
- void
- SC_EdgeList(
- LOD_EdgeInd e
- );
-
-
- // Check to see that the edges of v1 and v2 are unique.
-
- bool
- SC_UniqueEdge(
- LOD_EdgeInd e
- );
-
-
-private :
-
-
- // Returns the edge index of the edge from v1 to v2.
- // Does this by searching the edge sets of v1 - but not v2.
- // If you are paranoid you should check both and make sure the
- // indices are the same. If the edge doe not exist edgeInd is empty.
-
- LOD_EdgeInd
- FindEdge(
- const LOD_VertexInd v1,
- const LOD_VertexInd v2
- );
-
- // Insert an edge into the mesh
- // Tie up the ptrs and create space for the edge
- // returns manifold errors - need to sort out memory edges
-
- bool
- InsertEdge(
- const LOD_VertexInd v1,
- const LOD_VertexInd v2,
- const LOD_FaceInd f,
- std::vector<LOD_EdgeInd> &new_edges
- );
-
-
-private :
-
- LOD_ManMesh2(
- );
-
- MEM_SmartPtr< std::vector<LOD_Vertex> > m_verts;
- MEM_SmartPtr< std::vector<LOD_TriFace> > m_faces;
- MEM_SmartPtr< std::vector<LOD_Edge> > m_edges;
-
- // not sure of these descrtiptions of the mesh should
- // reside in this class coz may lead to very bloated interface.
-
- MT_Vector3 m_bbox_min;
- MT_Vector3 m_bbox_max;
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_MeshBounds.h b/intern/decimation/intern/LOD_MeshBounds.h
deleted file mode 100644
index c95e6c7b61f..00000000000
--- a/intern/decimation/intern/LOD_MeshBounds.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshBounds.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_MESHBOUNDS_H__
-#define __LOD_MESHBOUNDS_H__
-
-#include "MEM_SmartPtr.h"
-#include "LOD_MeshPrimitives.h"
-#include "LOD_ManMesh2.h"
-#include "MT_assert.h"
-
-// simple class to compute the mesh bounds of a manifold mesh,
-
-class LOD_MeshBounds {
-
-public :
- static
- LOD_MeshBounds *
- New(
- ){
-
- MEM_SmartPtr<LOD_MeshBounds> output(new LOD_MeshBounds());
- return output.Release();
- }
-
- void
- ComputeBounds(
- const LOD_ManMesh2 * mesh
- ){
- MT_assert(mesh!=NULL);
- MT_assert(mesh->VertexSet().size() > 0);
-
- const std::vector<LOD_Vertex> &verts = mesh->VertexSet();
-
- m_min = verts[0].pos;
- m_max = verts[0].pos;
-
- // iterate through the verts
-
- int t;
- const int size = verts.size();
-
- for (t=1; t< size ; ++t) {
-
- UpdateBounds(verts[t].pos,m_min,m_max);
- }
- }
-
- MT_Vector3
- Min(
- ) const {
- return m_min;
- }
-
- MT_Vector3
- Max(
- ) const {
- return m_max;
- }
-
-private :
-
- void
- UpdateBounds(
- MT_Vector3 vertex,
- MT_Vector3& min,
- MT_Vector3& max
- ) {
- if (vertex.x() < min.x()) {
- min.x() = vertex.x();
- } else
- if (vertex.x() > max.x()) {
- max.x()= vertex.x();
- }
-
- if (vertex.y() < min.y()) {
- min.y() = vertex.y();
- } else
- if (vertex.y() > max.y()) {
- max.y()= vertex.y();
- }
-
- if (vertex.z() < min.z()) {
- min.z() = vertex.z();
- } else
- if (vertex.z() > max.z()) {
- max.z()= vertex.z();
- }
- }
-
- LOD_MeshBounds(
- ) :
- m_min(0,0,0),
- m_max(0,0,0)
- {
- };
-
- MT_Vector3 m_min;
- MT_Vector3 m_max;
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.cpp b/intern/decimation/intern/LOD_MeshPrimitives.cpp
deleted file mode 100644
index ee4e4c120fc..00000000000
--- a/intern/decimation/intern/LOD_MeshPrimitives.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshPrimitives.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_MeshPrimitives.h"
-
-#include "MT_assert.h"
-#include "LOD_MeshException.h"
-#include <algorithm>
-
-using namespace std;
-
-// Vertex Methods
-/////////////////
-
-LOD_Vertex::
-LOD_Vertex(
-) :
- pos (MT_Vector3()),
- m_select_tag(false)
-{
-};
-
- bool
-LOD_Vertex::
-RemoveEdge(
- LOD_EdgeInd e
-){
-
- vector<LOD_EdgeInd>::iterator result = find(m_edges.begin(),m_edges.end(),e);
- if (result == m_edges.end()) {
- return false;
- }
-
- std::swap(*result, m_edges.back());
- m_edges.pop_back();
- return true;
-};
-
- void
-LOD_Vertex::
-AddEdge(
- LOD_EdgeInd e
-){
- m_edges.push_back(e);
-};
-
- void
-LOD_Vertex::
-SwapEdge(
- LOD_EdgeInd e_old,
- LOD_EdgeInd e_new
-){
-
- vector<LOD_EdgeInd>::iterator result =
- find(m_edges.begin(),m_edges.end(),e_old);
- if (result == m_edges.end()) {
- MT_assert(false);
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
- }
-
- *result = e_new;
-};
-
- bool
-LOD_Vertex::
-SelectTag(
-) const {
- return m_select_tag;
-};
-
- void
-LOD_Vertex::
-SetSelectTag(
- bool tag
-){
- m_select_tag = tag;
-};
-
- bool
-LOD_Vertex::
-Degenerate(
-){
- return m_edges.empty();
-}
-
- void
-LOD_Vertex::
-CopyPosition(
- float *float_ptr
-){
- pos.getValue(float_ptr);
-}
-
-
-
-// Edge Methods
-///////////////
-
-LOD_Edge::
-LOD_Edge (
-) {
- m_verts[0] = m_verts[1] = LOD_VertexInd::Empty();
- m_faces[0] = m_faces[1] = LOD_FaceInd::Empty();
-}
-
- bool
-LOD_Edge::
-operator == (
- LOD_Edge & rhs
-) {
- // edges are the same if their vertex indices are the
- // same!!! Other properties are not checked
-
- int matches = 0;
-
- if (this->m_verts[0] == rhs.m_verts[0]) {
- ++matches;
- }
- if (this->m_verts[1] == rhs.m_verts[0]) {
- ++matches;
- }
- if (this->m_verts[0] == rhs.m_verts[1]) {
- ++matches;
- }
- if (this->m_verts[1] == rhs.m_verts[1]) {
- ++matches;
- }
-
- if (matches >= 2) {
- return true;
- }
- return false;
-}
-
-// Elementary helper methods
-////////////////////////////
-
- LOD_FaceInd
-LOD_Edge::
-OpFace(
- LOD_FaceInd f
-) const {
- if (f == m_faces[0]) {
- return m_faces[1];
- } else
- if (f == m_faces[1]) {
- return m_faces[0];
- } else {
- MT_assert(false);
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
-
- return LOD_FaceInd::Empty();
- }
-}
-
- void
-LOD_Edge::
-SwapFace(
- LOD_FaceInd old_f,
- LOD_FaceInd new_f
-) {
- if (old_f == m_faces[0]) {
- m_faces[0] = new_f;
- } else
- if (old_f == m_faces[1]) {
- m_faces[1] = new_f;
- } else {
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
- }
-}
-
-
-// return the half edge face - the half edge is defined
-// by the {vertex,edge} tuple.
-
- LOD_FaceInd
-LOD_Edge::
-HalfEdgeFace(
- LOD_VertexInd vi
-){
- if (vi == m_verts[0]) return m_faces[0];
- if (vi == m_verts[1]) return m_faces[1];
- MT_assert(false);
-
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
-
- return LOD_FaceInd::Empty();
-}
-
-
- LOD_VertexInd
-LOD_Edge::
-OpVertex(
- LOD_VertexInd vi
-) {
- if (vi == m_verts[0]) return m_verts[1];
- if (vi == m_verts[1]) return m_verts[0];
- MT_assert(false);
-
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
-
- return LOD_VertexInd::Empty();
-}
-
-// replace the vertex v_old with vertex v_new
-// error if v_old is not one of the original vertices
-
- void
-LOD_Edge::
-SwapVertex(
- LOD_VertexInd v_old,
- LOD_VertexInd v_new
-) {
- if (v_old == m_verts[0]) {
- m_verts[0] = v_new;
- } else
- if (v_old == m_verts[1]) {
- m_verts[1] = v_new;
- } else {
-
- MT_assert(false);
-
- LOD_MeshException e(LOD_MeshException::e_search_error);
- throw(e);
- }
- if(m_verts[0] == m_verts[1]) {
- MT_assert(false);
-
- LOD_MeshException e(LOD_MeshException::e_non_manifold);
- throw(e);
- }
-
-}
-
- bool
-LOD_Edge::
-SelectTag(
-) const {
- return bool(m_verts[1].Tag() & 0x1);
-};
-
- void
-LOD_Edge::
-SetSelectTag(
- bool tag
-) {
- m_verts[1].SetTag(int(tag));
-};
-
- int
-LOD_Edge::
-OpenTag(
-) const {
- return m_faces[0].Tag();
-}
-
- void
-LOD_Edge::
-SetOpenTag(
- int tag
-) {
- m_faces[0].SetTag(tag);
-}
-
- bool
-LOD_Edge::
-Degenerate(
-) const {
- return (
- (m_faces[0].IsEmpty() && m_faces[1].IsEmpty()) ||
- (m_verts[0] == m_verts[1])
- );
-};
-
-// TriFace Methods
-//////////////////
-
-LOD_TriFace::
-LOD_TriFace(
-) {
- m_verts[0] = m_verts[1] = m_verts[2] = LOD_VertexInd::Empty();
-}
-
-// Elementary helper methods
-////////////////////////////
-
- void
-LOD_TriFace::
-SwapVertex(
- LOD_VertexInd old_v,
- LOD_VertexInd new_v
-) {
- // could save branching here...
-
- if (m_verts[0] == old_v) {
- m_verts[0] = new_v;
- } else
- if (m_verts[1] == old_v) {
- m_verts[1] = new_v;
- } else
- if (m_verts[2] == old_v) {
- m_verts[2] = new_v;
- } else {
- MT_assert(false);
-
- LOD_MeshException excep(LOD_MeshException::e_search_error);
- throw(excep);
- }
-}
-
- bool
-LOD_TriFace::
-SelectTag(
-) const {
- return bool(m_verts[1].Tag() & 0x1);
-};
-
- void
-LOD_TriFace::
-SetSelectTag(
- bool tag
-) {
- m_verts[1].SetTag(int(tag));
-};
-
- int
-LOD_TriFace::
-OpenTag(
-) {
- return m_verts[2].Tag();
-}
-
- void
-LOD_TriFace::
-SetOpenTag(
- int tag
-) {
- m_verts[2].SetTag(tag);
-}
-
- bool
-LOD_TriFace::
-Degenerate(
-) {
-
- return (
- (m_verts[0] == m_verts[1]) ||
- (m_verts[1] == m_verts[2]) ||
- (m_verts[2] == m_verts[0])
- );
-}
-
- void
-LOD_TriFace::
-CopyVerts(
- int * index_ptr
-){
- index_ptr[0] = m_verts[0];
- index_ptr[1] = m_verts[1];
- index_ptr[2] = m_verts[2];
-};
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.h b/intern/decimation/intern/LOD_MeshPrimitives.h
deleted file mode 100644
index ea2d157308b..00000000000
--- a/intern/decimation/intern/LOD_MeshPrimitives.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_MeshPrimitives.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_MESHPRIMITIVES_H__
-#define __LOD_MESHPRIMITIVES_H__
-
-#include "MT_Vector3.h"
-#include "CTR_TaggedIndex.h"
-#include "CTR_UHeap.h"
-#include <vector>
-
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_VertexInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_EdgeInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_FaceInd;
-typedef CTR_TaggedIndex<24,0x00ffffff> LOD_HeapInd;
-
-class LOD_Vertex {
-public :
- MT_Vector3 pos;
- std::vector<LOD_EdgeInd> m_edges;
- bool m_select_tag;
-
- LOD_Vertex(
- );
-
- bool
- RemoveEdge(
- LOD_EdgeInd e
- );
-
- void
- AddEdge(
- LOD_EdgeInd e
- );
-
- void
- SwapEdge(
- LOD_EdgeInd e_old,
- LOD_EdgeInd e_new
- );
-
- bool
- SelectTag(
- ) const;
-
- void
- SetSelectTag(
- bool tag
- );
-
- bool
- Degenerate(
- );
-
- void
- CopyPosition(
- float *float_ptr
- );
-
-private :
-
-
-};
-
-class LOD_Edge : public CTR_UHeapable {
-public :
- LOD_VertexInd m_verts[2];
- LOD_FaceInd m_faces[2];
-
- LOD_Edge (
- );
-
- bool operator == (
- LOD_Edge & rhs
- );
-
- // Elementary helper methods
- ////////////////////////////
-
- LOD_FaceInd
- OpFace(
- LOD_FaceInd f
- ) const;
-
- void
- SwapFace(
- LOD_FaceInd old_f,
- LOD_FaceInd new_f
- );
-
-
- // return the half edge face - the half edge is defined
- // by the {vertex,edge} tuple.
-
- LOD_FaceInd
- HalfEdgeFace(
- LOD_VertexInd vi
- );
-
-
- LOD_VertexInd
- OpVertex(
- LOD_VertexInd vi
- );
-
- // replace the vertex v_old with vertex v_new
- // error if v_old is not one of the original vertices
-
- void
- SwapVertex(
- LOD_VertexInd v_old,
- LOD_VertexInd v_new
- );
-
- bool
- SelectTag(
- ) const;
-
- void
- SetSelectTag(
- bool tag
- );
-
- int
- OpenTag(
- ) const;
-
- void
- SetOpenTag(
- int tag
- );
-
- bool
- Degenerate(
- ) const;
-
- bool
- BoundaryEdge(
- ) const {
- return (m_faces[0].IsEmpty() || m_faces[1].IsEmpty());
- };
-
-
-};
-
-class LOD_TriFace {
-public:
-
- LOD_VertexInd m_verts[3];
-
- LOD_TriFace(
- );
-
- // Elementary helper methods
- ////////////////////////////
-
- void
- SwapVertex(
- LOD_VertexInd old_v,
- LOD_VertexInd new_v
- );
-
- bool
- SelectTag(
- ) const;
-
- void
- SetSelectTag(
- bool tag
- );
-
- int
- OpenTag(
- );
- void
- SetOpenTag(
- int tag
- );
-
- bool
- Degenerate(
- );
-
- void
- CopyVerts(
- int * index_ptr
- );
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_QSDecimator.cpp b/intern/decimation/intern/LOD_QSDecimator.cpp
deleted file mode 100644
index bdcf7950447..00000000000
--- a/intern/decimation/intern/LOD_QSDecimator.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QSDecimator.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_QSDecimator.h"
-
-#include "LOD_ExternBufferEditor.h"
-
-using namespace std;
-
- LOD_QSDecimator *
-LOD_QSDecimator::
-New(
- LOD_ManMesh2 &mesh,
- LOD_ExternNormalEditor &face_editor,
- LOD_ExternBufferEditor &extern_editor
-){
-
- MEM_SmartPtr<LOD_QSDecimator> output
- = new LOD_QSDecimator(mesh,face_editor,extern_editor);
-
- MEM_SmartPtr<LOD_EdgeCollapser > collapser(LOD_EdgeCollapser::New());
- MEM_SmartPtr<LOD_QuadricEditor> q_editor(LOD_QuadricEditor::New(mesh));
-
- if (
- output == NULL ||
- collapser == NULL ||
- q_editor == NULL
- ) {
- return NULL;
- }
- output->m_collapser = collapser.Release();
- output->m_quadric_editor = q_editor.Release();
- return output.Release();
-}
-
-
-
- bool
-LOD_QSDecimator::
-Arm(
-){
- MT_assert(!m_is_armed);
- bool heap_result = BuildHeap();
- if (!heap_result) {
- return false;
- }
- m_is_armed = true;
- return true;
-}
-
- bool
-LOD_QSDecimator::
-Step(
-){
- return CollapseEdge();
-}
-
-
-LOD_QSDecimator::
-LOD_QSDecimator(
- LOD_ManMesh2 &mesh,
- LOD_ExternNormalEditor &face_editor,
- LOD_ExternBufferEditor &extern_editor
-) :
- m_is_armed (false),
- m_mesh(mesh),
- m_face_editor(face_editor),
- m_extern_editor(extern_editor)
-{
- m_deg_edges.reserve(32);
- m_deg_faces.reserve(32);
- m_deg_vertices.reserve(32);
- m_update_faces.reserve(32);
- m_new_edges.reserve(32);
- m_update_vertices.reserve(32);
-};
-
- bool
-LOD_QSDecimator::
-CollapseEdge(
-){
-
- // find an edge to collapse
-
- // FIXME force an edge collapse
- // or return false
-
- std::vector<LOD_Edge> & edges = m_mesh.EdgeSet();
- std::vector<LOD_Vertex> & verts = m_mesh.VertexSet();
- std::vector<LOD_Quadric> & quadrics = m_quadric_editor->Quadrics();
- int size = edges.size();
-
- if (size == 0) return false;
-
- const int heap_top = m_heap->Top();
-
- if (heap_top == -1 || edges[heap_top].HeapKey() <= -MT_INFINITY) {
- return false;
- }
-
- // compute the target position
- MT_Vector3 new_vertex = m_quadric_editor->TargetVertex(edges[heap_top]);
- LOD_Quadric & q0 = quadrics[edges[heap_top].m_verts[0]];
- LOD_Quadric & q1 = quadrics[edges[heap_top].m_verts[1]];
-
- LOD_Vertex &v0 = verts[edges[heap_top].m_verts[0]];
- LOD_Vertex &v1 = verts[edges[heap_top].m_verts[1]];
-
- LOD_Quadric sum = q0;
- sum += q1;
-
-
- if (m_collapser->CollapseEdge(
- heap_top,
- m_mesh,
- m_deg_edges,
- m_deg_faces,
- m_deg_vertices,
- m_new_edges,
- m_update_faces,
- m_update_vertices
- )) {
-
- // assign new vertex position
-
- v0.pos = new_vertex;
- v1.pos = new_vertex;
-
- // sum the quadrics of v0 and v1
- q0 = sum;
- q1 = sum;
-
- // ok update the primitive properties
-
- m_face_editor.Update(m_update_faces);
- m_face_editor.UpdateVertexNormals(m_update_vertices);
-
- // update the external vertex buffer
- m_extern_editor.CopyModifiedVerts(m_mesh,m_update_vertices);
-
- // update the external face buffer
- m_extern_editor.CopyModifiedFaces(m_mesh,m_update_faces);
-
- // update the edge heap
- UpdateHeap(m_deg_edges,m_new_edges);
-
- m_quadric_editor->Remove(m_deg_vertices);
- m_face_editor.Remove(m_deg_faces);
- m_face_editor.RemoveVertexNormals(m_deg_vertices);
-
- // delete the primitives
-
- DeletePrimitives(m_deg_edges,m_deg_faces,m_deg_vertices);
-
- } else {
- // the edge could not be collapsed at the moment - so
- // we adjust it's priority and add it back to the heap.
- m_heap->Remove(&edges[0],0);
- edges[heap_top].HeapKey() = - MT_INFINITY;
- m_heap->Insert(&edges[0],heap_top);
- }
-
- //clear all the temporary buffers
-
- m_deg_faces.clear();
- m_deg_edges.clear();
- m_deg_vertices.clear();
-
- m_update_faces.clear();
- m_update_vertices.clear();
- m_new_edges.clear();
-
- return true;
-
-}
-
- void
-LOD_QSDecimator::
-DeletePrimitives(
- const vector<LOD_EdgeInd> & degenerate_edges,
- const vector<LOD_FaceInd> & degenerate_faces,
- const vector<LOD_VertexInd> & degenerate_vertices
-) {
-
- // assumes that the 3 vectors are sorted in descending order.
-
- // Delete Degnerate primitives
- //////////////////////////////
-
-
- // delete the old edges - we have to be very careful here
- // mesh.delete() swaps edges to be deleted with the last edge in
- // the edge buffer. However the next edge to be deleted may have
- // been the last edge in the buffer!
-
- // One way to solve this is to sort degenerate_edges in descending order.
- // And then delete them in that order.
-
- // it is also vital that degenerate_edges contains no duplicates
-
- vector<LOD_EdgeInd>::const_iterator edge_it = degenerate_edges.begin();
- vector<LOD_EdgeInd>::const_iterator edge_end = degenerate_edges.end();
-
- for (; edge_it != edge_end; ++edge_it) {
- m_mesh.DeleteEdge(*edge_it,m_heap);
- }
-
-
-
- vector<LOD_FaceInd>::const_iterator face_it = degenerate_faces.begin();
- vector<LOD_FaceInd>::const_iterator face_end = degenerate_faces.end();
-
- for (;face_it != face_end; ++face_it) {
- m_mesh.DeleteFace(m_extern_editor,*face_it);
- }
-
- vector<LOD_VertexInd>::const_iterator vertex_it = degenerate_vertices.begin();
- vector<LOD_VertexInd>::const_iterator vertex_end = degenerate_vertices.end();
-
- for (;vertex_it != vertex_end; ++vertex_it) {
- m_mesh.DeleteVertex(m_extern_editor,*vertex_it);
- }
-}
-
-
- bool
-LOD_QSDecimator::
-BuildHeap(
-){
- // build the quadrics
-
- if (m_quadric_editor->BuildQuadrics(m_face_editor,true) == false) return false;
-
-
- m_heap = CTR_UHeap<LOD_Edge>::New();
- // load in edge pointers to the heap
-
- std::vector<LOD_Edge> & edge_set= m_mesh.EdgeSet();
-
- // UNUSED
- // std::vector<LOD_Edge>::const_iterator edge_end = edge_set.end();
- // std::vector<LOD_Edge>::iterator edge_start = edge_set.begin();
-
- std::vector<int> & heap_vector = m_heap->HeapVector();
-
- for (unsigned int i = 0; i < edge_set.size(); ++i) {
- edge_set[i].HeapPos() = i;
- heap_vector.push_back(i);
- }
-
- m_heap->MakeHeap(&edge_set[0]);
-
- return true;
-}
-
- void
-LOD_QSDecimator::
-UpdateHeap(
- std::vector<LOD_EdgeInd> &deg_edges,
- std::vector<LOD_EdgeInd> &new_edges
-){
- // first of all compute values for the new edges
- // and bung them on the heap.
-
- std::vector<LOD_Edge> & edge_set= m_mesh.EdgeSet();
-
- std::vector<LOD_EdgeInd>::const_iterator edge_it = new_edges.begin();
- std::vector<LOD_EdgeInd>::const_iterator end_it = new_edges.end();
-
-
- // insert all the new edges
- ///////////////////////////
-
- // compute edge costs ffor the new edges
-
- m_quadric_editor->ComputeEdgeCosts(new_edges);
-
- // inser the new elements into the heap
-
- for (; edge_it != end_it; ++edge_it) {
- m_heap->Insert(&edge_set[0],*edge_it);
- }
-
-
- // remove all the old values from the heap
-
- edge_it = deg_edges.begin();
- end_it = deg_edges.end();
-
- for (; edge_it != end_it; ++edge_it) {
- LOD_Edge &e = edge_set[*edge_it];
- m_heap->Remove(&edge_set[0],e.HeapPos());
-
- e.HeapPos() = -1;
-
- }
-}
-
diff --git a/intern/decimation/intern/LOD_QSDecimator.h b/intern/decimation/intern/LOD_QSDecimator.h
deleted file mode 100644
index 2ac223996f2..00000000000
--- a/intern/decimation/intern/LOD_QSDecimator.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QSDecimator.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_QSDECIMATOR_H__
-#define __LOD_QSDECIMATOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "LOD_ExternNormalEditor.h"
-#include "LOD_EdgeCollapser.h"
-#include "LOD_QuadricEditor.h"
-
-class LOD_ExternBufferEditor;
-
-class LOD_QSDecimator : public MEM_NonCopyable {
-
-public :
-
- static
- LOD_QSDecimator *
- New(
- LOD_ManMesh2 &mesh,
- LOD_ExternNormalEditor &face_editor,
- LOD_ExternBufferEditor &extern_editor
- );
-
-
- bool
- Arm(
- );
-
-
- bool
- Step(
- );
-
-private :
-
- LOD_QSDecimator(
- LOD_ManMesh2 &mesh,
- LOD_ExternNormalEditor &face_editor,
- LOD_ExternBufferEditor &extern_editor
- );
-
- bool
- CollapseEdge(
- );
-
- bool
- BuildHeap(
- );
-
- void
- UpdateHeap(
- std::vector<LOD_EdgeInd> &deg_edges,
- std::vector<LOD_EdgeInd> &new_edges
- );
-
- void
- DeletePrimitives(
- const std::vector<LOD_EdgeInd> & degenerate_edges,
- const std::vector<LOD_FaceInd> & degenerate_faces,
- const std::vector<LOD_VertexInd> & degenerate_vertices
- );
-
-
-private :
-
- // owned by this class
- //////////////////////
-
- MEM_SmartPtr<LOD_EdgeCollapser> m_collapser;
- MEM_SmartPtr<CTR_UHeap<LOD_Edge> > m_heap;
- MEM_SmartPtr<LOD_QuadricEditor> m_quadric_editor;
-
- bool m_is_armed;
-
- // arguments to New(...)
- ////////////////////////
-
- LOD_ManMesh2 & m_mesh;
- LOD_ExternNormalEditor &m_face_editor;
- LOD_ExternBufferEditor & m_extern_editor;
-
- // temporary buffers
- ////////////////////
-
- std::vector<LOD_FaceInd> m_deg_faces;
- std::vector<LOD_EdgeInd> m_deg_edges;
- std::vector<LOD_VertexInd> m_deg_vertices;
-
- std::vector<LOD_FaceInd> m_update_faces;
- std::vector<LOD_EdgeInd> m_new_edges;
- std::vector<LOD_VertexInd> m_update_vertices;
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_Quadric.h b/intern/decimation/intern/LOD_Quadric.h
deleted file mode 100644
index fc69530ac43..00000000000
--- a/intern/decimation/intern/LOD_Quadric.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_Quadric.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_QUADRIC_H__
-#define __LOD_QUADRIC_H__
-
-#include "MT_Vector3.h"
-#include "MT_Matrix3x3.h"
-
-
-class LOD_Quadric {
-
-private:
- MT_Scalar a2, ab, ac, ad;
- MT_Scalar b2, bc, bd;
- MT_Scalar c2, cd;
- MT_Scalar d2;
-
- //void init(MT_Scalar a, MT_Scalar b, MT_Scalar c, MT_Scalar d);
-
-public:
-
- LOD_Quadric(
- ) {
- Clear();
- };
-
- LOD_Quadric(
- const MT_Vector3 & vec,
- const MT_Scalar & offset
- ) {
- a2 = vec[0] *vec[0];
- b2 = vec[1] *vec[1];
- c2 = vec[2] *vec[2];
-
- ab = vec[0]*vec[1];
- ac = vec[0]*vec[2];
- bc = vec[1]*vec[2];
-
- MT_Vector3 temp = vec*offset;
- ad = temp[0];
- bd = temp[1];
- cd = temp[2];
-
- d2 = offset*offset;
- };
-
- MT_Matrix3x3
- Tensor(
- ) const {
- // return a symmetric matrix
-
- return MT_Matrix3x3(
- a2,ab,ac,
- ab,b2,bc,
- ac,bc,c2
- );
- };
-
-
- MT_Vector3
- Vector(
- ) const {
- return MT_Vector3(ad, bd, cd);
- };
-
- void
- Clear(
- MT_Scalar val=0.0
- ) {
- a2=ab=ac=ad=b2=bc=bd=c2=cd=d2=val;
- };
-
- LOD_Quadric &
- operator=(
- const LOD_Quadric& Q
- ) {
-
- a2 = Q.a2; ab = Q.ab; ac = Q.ac; ad = Q.ad;
- b2 = Q.b2; bc = Q.bc; bd = Q.bd;
- c2 = Q.c2; cd = Q.cd;
- d2 = Q.d2;
- return *this;
- };
-
- LOD_Quadric&
- operator+=(
- const LOD_Quadric& Q
- ) {
- a2 += Q.a2; ab += Q.ab; ac += Q.ac; ad += Q.ad;
- b2 += Q.b2; bc += Q.bc; bd += Q.bd;
- c2 += Q.c2; cd += Q.cd;
- d2 += Q.d2;
- return *this;
- };
-
- LOD_Quadric&
- operator*=(
- const MT_Scalar & s
- ) {
- a2 *= s; ab *= s; ac *= s; ad *= s;
- b2 *= s; bc *= s; bd *= s;
- c2 *= s; cd *= s;
- d2 *= s;
- return *this;
- };
-
-
- MT_Scalar
- Evaluate(
- const MT_Vector3 &v
- ) const {
- // compute the LOD_Quadric error
-
- return v[0]*v[0]*a2 + 2*v[0]*v[1]*ab + 2*v[0]*v[2]*ac + 2*v[0]*ad
- +v[1]*v[1]*b2 + 2*v[1]*v[2]*bc + 2*v[1]*bd
- +v[2]*v[2]*c2 + 2*v[2]*cd
- + d2;
- };
-
- bool
- Optimize(
- MT_Vector3& v
- ) const {
-
- MT_Scalar det = Tensor().determinant();
- if (MT_fuzzyZero(det)) {
- return false;
- }
-
- v = -((Tensor().inverse()) * Vector());
- return true;
- };
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_QuadricEditor.cpp b/intern/decimation/intern/LOD_QuadricEditor.cpp
deleted file mode 100644
index 9c895ee25f1..00000000000
--- a/intern/decimation/intern/LOD_QuadricEditor.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QuadricEditor.cpp
- * \ingroup decimation
- */
-
-
-#include "LOD_QuadricEditor.h"
-#include "LOD_ExternNormalEditor.h"
-
-// Creation
-///////////
-
-using namespace std;
-
-
-LOD_QuadricEditor::
-LOD_QuadricEditor(
- LOD_ManMesh2 &mesh
-) :
- m_quadrics(NULL),
- m_mesh(mesh)
-{
-};
-
- LOD_QuadricEditor *
-LOD_QuadricEditor::
-New(
- LOD_ManMesh2 &mesh
-){
- //same number of quadrics as vertices in the mesh
-
- MEM_SmartPtr<LOD_QuadricEditor> output(new LOD_QuadricEditor(mesh));
-
- if (output == NULL) {
- return NULL;
- }
- return output.Release();
-}
-
-
-// Property editor interface
-////////////////////////////
-
- void
-LOD_QuadricEditor::
-Remove(
- std::vector<LOD_VertexInd> &sorted_vertices
-){
- vector<LOD_Quadric> & quadrics = *m_quadrics;
-
- vector<LOD_VertexInd>::const_iterator it_start = sorted_vertices.begin();
- vector<LOD_VertexInd>::const_iterator it_end = sorted_vertices.end();
-
- for (; it_start != it_end; ++it_start) {
-
- if (quadrics.size() > 0) {
- LOD_Quadric temp = quadrics[*it_start];
-
- quadrics[*it_start] = quadrics.back();
- quadrics.back() = temp;
-
- quadrics.pop_back();
- }
- }
-};
-
-
-// Editor specific methods
-//////////////////////////
-
- bool
-LOD_QuadricEditor::
-BuildQuadrics(
- LOD_ExternNormalEditor& normal_editor,
- bool preserve_boundaries
-){
- if (m_quadrics != NULL) delete(m_quadrics);
-
- m_quadrics =new vector<LOD_Quadric> (m_mesh.VertexSet().size());
- if (m_quadrics == NULL) return false;
-
- // iterate through the face set of the mesh
- // compute a quadric based upon that face and
- // add it to each of it's vertices quadrics.
-
- const vector<LOD_TriFace> &faces = m_mesh.FaceSet();
- const vector<LOD_Vertex> &verts = m_mesh.VertexSet();
- vector<LOD_Edge> &edges = m_mesh.EdgeSet();
-
- const vector<MT_Vector3> &normals = normal_editor.Normals();
- vector<MT_Vector3>::const_iterator normal_it = normals.begin();
-
- vector<LOD_TriFace>::const_iterator face_it = faces.begin();
- vector<LOD_TriFace>::const_iterator face_end = faces.end();
-
- vector<LOD_Quadric> & quadrics = *m_quadrics;
-
-
- for (; face_it != face_end; ++face_it, ++normal_it) {
-
- MT_Vector3 normal = *normal_it;
- MT_Scalar offset = -normal.dot(verts[face_it->m_verts[0]].pos);
-
- LOD_Quadric q(normal,offset);
-
- quadrics[face_it->m_verts[0]] += q;
- quadrics[face_it->m_verts[1]] += q;
- quadrics[face_it->m_verts[2]] += q;
- }
-
- if (preserve_boundaries) {
-
- // iterate through the edge set and add a boundary quadric to
- // each of the boundary edges vertices.
-
- vector<LOD_Edge>::const_iterator edge_it = edges.begin();
- vector<LOD_Edge>::const_iterator edge_end = edges.end();
-
- for (; edge_it != edge_end; ++edge_it) {
- if (edge_it->BoundaryEdge()) {
-
- // compute a plane perpendicular to the edge and the normal
- // of the edges single polygon.
- const MT_Vector3 & v0 = verts[edge_it->m_verts[0]].pos;
- const MT_Vector3 & v1 = verts[edge_it->m_verts[1]].pos;
-
- MT_Vector3 edge_vector = v1 - v0;
-
- LOD_FaceInd edge_face = edge_it->OpFace(LOD_EdgeInd::Empty());
- edge_vector = edge_vector.cross(normals[edge_face]);
-
- if (!edge_vector.fuzzyZero()) {
- edge_vector.normalize();
-
- LOD_Quadric boundary_q(edge_vector, - edge_vector.dot(v0));
- boundary_q *= 100;
-
- quadrics[edge_it->m_verts[0]] += boundary_q;
- quadrics[edge_it->m_verts[1]] += boundary_q;
- }
- }
- }
- }
-
-
- // initiate the heap keys of the edges by computing the edge costs.
-
- vector<LOD_Edge>::iterator edge_it = edges.begin();
- vector<LOD_Edge>::const_iterator edge_end = edges.end();
-
- for (; edge_it != edge_end; ++edge_it) {
-
- MT_Vector3 target = TargetVertex(*edge_it);
-
- LOD_Edge &e = *edge_it;
- const LOD_Quadric &q0 = quadrics[e.m_verts[0]];
- const LOD_Quadric &q1 = quadrics[e.m_verts[1]];
-
- e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
- }
-
- return true;
-
-};
-
- MT_Vector3
-LOD_QuadricEditor::
-TargetVertex(
- LOD_Edge & e
-){
-
- // compute an edge contration target for edge ei
- // this is computed by summing it's vertices quadrics and
- // optimizing the result.
- vector<LOD_Vertex> &verts = m_mesh.VertexSet();
-
- vector<LOD_Quadric> &quadrics = *m_quadrics;
-
- LOD_VertexInd v0 = e.m_verts[0];
- LOD_VertexInd v1 = e.m_verts[1];
-
- LOD_Quadric q0 = quadrics[v0];
- q0 += quadrics[v1];
-
- MT_Vector3 result;
-
- if (q0.Optimize(result)) {
- return result;
- } else {
- // the quadric was degenerate -> just take the average of
- // v0 and v1
-
- return ((verts[v0].pos + verts[v1].pos) * 0.5);
- }
-};
-
- void
-LOD_QuadricEditor::
-ComputeEdgeCosts(
- vector<LOD_EdgeInd> &edges
-){
-
- // for each we compute the target vertex and then compute
- // the quadric error e = Q1(v') + Q2(v')
- vector<LOD_Edge> &edge_set = m_mesh.EdgeSet();
-
- vector<LOD_Quadric> &quadrics = *m_quadrics;
-
- vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin();
- vector<LOD_EdgeInd>::const_iterator edge_end = edges.end();
-
- for (; edge_it != edge_end; ++edge_it) {
-
- MT_Vector3 target = TargetVertex(edge_set[*edge_it]);
-
- LOD_Edge &e = edge_set[*edge_it];
- LOD_Quadric q0 = quadrics[e.m_verts[0]];
- const LOD_Quadric &q1 = quadrics[e.m_verts[1]];
-
- e.HeapKey() = -float(q0.Evaluate(target) + q1.Evaluate(target));
- }
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/decimation/intern/LOD_QuadricEditor.h b/intern/decimation/intern/LOD_QuadricEditor.h
deleted file mode 100644
index 0a66d299e15..00000000000
--- a/intern/decimation/intern/LOD_QuadricEditor.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_QuadricEditor.h
- * \ingroup decimation
- */
-
-
-#ifndef __LOD_QUADRICEDITOR_H__
-#define __LOD_QUADRICEDITOR_H__
-
-#include "MEM_NonCopyable.h"
-#include "LOD_ManMesh2.h"
-#include "MT_Vector3.h"
-#include "LOD_Quadric.h"
-
-class LOD_ExternNormalEditor;
-
-
-class LOD_QuadricEditor : public MEM_NonCopyable
-{
-
-public :
-
- // Creation
- ///////////
-
- static
- LOD_QuadricEditor *
- New(
- LOD_ManMesh2 &mesh
- );
-
- // Property editor interface
- ////////////////////////////
-
- void
- Remove(
- std::vector<LOD_VertexInd> &sorted_vertices
- );
-
- void
- Update(
- std::vector<LOD_FaceInd> &sorted_vertices
- );
-
-
- std::vector<LOD_Quadric> &
- Quadrics(
- ) const {
- return *m_quadrics;
- };
-
-
- // Editor specific methods
- //////////////////////////
-
- bool
- BuildQuadrics(
- LOD_ExternNormalEditor& normal_editor,
- bool preserve_boundaries
- );
-
-
- void
- ComputeEdgeCosts(
- std::vector<LOD_EdgeInd> &edges
- );
-
- MT_Vector3
- TargetVertex(
- LOD_Edge &e
- );
-
- ~LOD_QuadricEditor(
- ){
- delete(m_quadrics);
- };
-
-
-private :
-
- std::vector<LOD_Quadric> * m_quadrics;
-
- LOD_ManMesh2 &m_mesh;
-
-private :
-
- LOD_QuadricEditor(LOD_ManMesh2 &mesh);
-
-
-
-};
-
-#endif
-
diff --git a/intern/decimation/intern/LOD_decimation.cpp b/intern/decimation/intern/LOD_decimation.cpp
deleted file mode 100644
index 49033933cd6..00000000000
--- a/intern/decimation/intern/LOD_decimation.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file decimation/intern/LOD_decimation.cpp
- * \ingroup decimation
- */
-
-
-// implementation of external c api
-#include "../extern/LOD_decimation.h"
-#include "LOD_DecimationClass.h"
-
-using namespace std;
-
- int
-LOD_LoadMesh(
- LOD_Decimation_InfoPtr info
-) {
- if (info == NULL) return 0;
- if (
- info->vertex_buffer == NULL ||
- info->vertex_normal_buffer == NULL ||
- info->triangle_index_buffer == NULL
- ) {
- return 0;
- }
-
-
- // create the intern object to hold all
- // the decimation classes
-
- MEM_SmartPtr<LOD_DecimationClass> intern(LOD_DecimationClass::New(info));
-
- if (intern == NULL) return 0;
-
- MEM_SmartPtr<vector<LOD_Vertex> > intern_vertex_buffer(new vector<LOD_Vertex>(info->vertex_num));
- if (intern_vertex_buffer == NULL) return 0;
-
- vector<LOD_Vertex>::iterator intern_vertex_it(intern_vertex_buffer->begin());
-
- // now load in the vertices to the mesh
-
- const int vertex_stride = 3;
-
- float * vertex_ptr = info->vertex_buffer;
- const float * vertex_end = vertex_ptr + info->vertex_num*vertex_stride;
-
- LOD_ManMesh2 &mesh = intern->Mesh();
-
- for (;vertex_ptr < vertex_end; vertex_ptr += vertex_stride,++intern_vertex_it) {
- intern_vertex_it->pos = MT_Vector3(vertex_ptr);
- }
-
- mesh.SetVertices(intern_vertex_buffer);
-
- // load in the triangles
-
- const int triangle_stride = 3;
-
- int * triangle_ptr = info->triangle_index_buffer;
- const int * triangle_end = triangle_ptr + info->face_num*triangle_stride;
-
- try {
-
- for (;triangle_ptr < triangle_end; triangle_ptr += triangle_stride) {
- mesh.AddTriangle(triangle_ptr);
- }
- }
-
- catch (...) {
- return 0;
- }
-
- // ok we have built the mesh
-
- intern->m_e_decimation_state = LOD_DecimationClass::e_loaded;
-
- info->intern = (void *) (intern.Release());
-
- return 1;
-}
-
- int
-LOD_PreprocessMesh(
- LOD_Decimation_InfoPtr info
-) {
- if (info == NULL) return 0;
- if (info->intern == NULL) return 0;
-
- LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
- if (intern->m_e_decimation_state != LOD_DecimationClass::e_loaded) return 0;
-
- // arm the various internal classes so that we are ready to step
- // through decimation
-
- intern->FaceEditor().BuildNormals();
- if (intern->Decimator().Arm() == false) return 0;
-
- // ok preprocessing done
- intern->m_e_decimation_state = LOD_DecimationClass::e_preprocessed;
-
- return 1;
-}
-
- int
-LOD_CollapseEdge(
- LOD_Decimation_InfoPtr info
-){
- if (info == NULL) return 0;
- if (info->intern == NULL) return 0;
- LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
- if (intern->m_e_decimation_state != LOD_DecimationClass::e_preprocessed) return 0;
-
- bool step_result = intern->Decimator().Step();
-
- return step_result == true ? 1 : 0;
-}
-
-
- int
-LOD_FreeDecimationData(
- LOD_Decimation_InfoPtr info
-){
- if (info == NULL) return 0;
- if (info->intern == NULL) return 0;
- LOD_DecimationClass *intern = (LOD_DecimationClass *) info->intern;
- delete(intern);
- info->intern = NULL;
- return 1;
-}
-
diff --git a/intern/elbeem/intern/ntl_geometryshader.h b/intern/elbeem/intern/ntl_geometryshader.h
index 61598556b7e..f43df6539e6 100644
--- a/intern/elbeem/intern/ntl_geometryshader.h
+++ b/intern/elbeem/intern/ntl_geometryshader.h
@@ -46,7 +46,7 @@ class ntlGeometryShader :
/*! notify object that dump is in progress (e.g. for field dump) */
virtual void notifyShaderOfDump(int dumptype, int frameNr,char *frameNrStr,string outfilename) = 0;
- /*! get ouput filename, returns global render outfile if empty */
+ /*! get output filename, returns global render outfile if empty */
string getOutFilename( void ) { return mOutFilename; }
protected:
diff --git a/intern/ghost/GHOST_IEventConsumer.h b/intern/ghost/GHOST_IEventConsumer.h
index 5682d04d434..5b6fa7ba046 100644
--- a/intern/ghost/GHOST_IEventConsumer.h
+++ b/intern/ghost/GHOST_IEventConsumer.h
@@ -42,8 +42,8 @@
* they want to receive events. The system will call the processEvent() method
* for every installed event consumer to pass events.
* \see GHOST_ISystem#addEventConsumer
- * \author Maarten Gribnau
- * \date May 14, 2001
+ * \author Maarten Gribnau
+ * \date May 14, 2001
*/
class GHOST_IEventConsumer
{
@@ -58,15 +58,14 @@ public:
/**
* This method is called by the system when it has events to dispatch.
* \see GHOST_ISystem#dispatchEvents
- * \param event The event that can be handled or ignored.
- * \return Indication as to whether the event was handled.
+ * \param event The event that can be handled or ignored.
+ * \return Indication as to whether the event was handled.
*/
virtual bool processEvent(GHOST_IEvent *event) = 0;
-
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_IEventConsumer")
#endif
};
-#endif // _GHOST_EVENT_CONSUMER_H_
-
+#endif /* __GHOST_IEVENTCONSUMER_H__ */
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 8aef81bb762..ad5d2379787 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -47,14 +47,14 @@ class GHOST_IEventConsumer;
* \section intro Introduction
*
* GHOST is yet another acronym. It stands for "Generic Handy Operating System
- * Toolkit". It has been created to replace the OpenGL utility tool kit
+ * Toolkit". It has been created to replace the OpenGL utility tool kit
* <a href="http://www.opengl.org/developers/documentation/glut.html">GLUT</a>.
* GLUT was used in <a href="http://www.blender3d.com">Blender</a> until the
* point that Blender needed to be ported to Apple's Mac OSX. Blender needed a
* number of modifications in GLUT to work but the GLUT sources for OSX were
* unavailable at the time. The decision was made to build our own replacement
- * for GLUT. In those days, NaN Technologies BV was the company that developed
- * Blender.
+ * for GLUT. In those days, NaN Technologies BV was the company that developed
+ * Blender.
* <br><br>
* Enough history. What does GHOST have to offer?<br>
* In short: everything that Blender needed from GLUT to run on all it's supported
@@ -96,7 +96,7 @@ class GHOST_IEventConsumer;
* <li>The C-API. For programs written in C.</li>
* <li>The C++-API. For programs written in C++.</li>
* </ul>
- * GHOST itself is writtem in C++ and the C-API is a wrapper around the C++
+ * GHOST itself is writtem in C++ and the C-API is a wrapper around the C++
* API.
*
* \subsection cplusplus_api The C++ API consists of the following files:
@@ -113,7 +113,7 @@ class GHOST_IEventConsumer;
* program in the ?/ghost/test/gears/ directory.
*
* \subsection c_api The C-API
- * To use GHOST in programs written in C, include the file GHOST_C-API.h in
+ * To use GHOST in programs written in C, include the file GHOST_C-API.h in
* your program. This file includes the GHOST_Types.h file for all GHOST types
* and defines functions that give you access to the same functionality present
* in the C++ API.<br>
@@ -123,7 +123,7 @@ class GHOST_IEventConsumer;
* \section work Work in progress
* \todo write WIP section
*/
-
+
/** \interface GHOST_ISystem
* Interface for classes that provide access to the operating system.
* There should be only one system class in an application.
@@ -136,8 +136,8 @@ class GHOST_IEventConsumer;
* -# Access to the state of the mouse buttons and the keyboard.
* -# Menus for windows with events generated when they are accessed (this is
* work in progress).
- * \author Maarten Gribnau
- * \date May 30, 2001
+ * \author Maarten Gribnau
+ * \date May 30, 2001
*/
class GHOST_ISystem
{
@@ -190,12 +190,12 @@ public:
/**
* Installs a timer.
- * Note that, on most operating systems, messages need to be processed in order
+ * Note that, on most operating systems, messages need to be processed in order
* for the timer callbacks to be invoked.
- * \param delay The time to wait for the first call to the timerProc (in milliseconds)
- * \param interval The interval between calls to the timerProc (in milliseconds)
- * \param timerProc The callback invoked when the interval expires,
- * \param userData Placeholder for user data.
+ * \param delay The time to wait for the first call to the timerProc (in milliseconds)
+ * \param interval The interval between calls to the timerProc (in milliseconds)
+ * \param timerProc The callback invoked when the interval expires,
+ * \param userData Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
@@ -225,22 +225,22 @@ public:
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
-
+
/**
* Create a new window.
- * The new window is added to the list of windows managed.
+ * The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
- * \param left The coordinate of the left edge of the window.
- * \param top The coordinate of the top edge of the window.
- * \param width The width the window.
- * \param height The height the window.
- * \param state The state of the window when opened.
- * \param type The type of drawing context installed in this window.
- * \param stereoVisual Create a stereo visual for quad buffered stereo.
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
- * \param parentWindow Parent (embedder) window
- * \return The new window (or 0 if creation failed).
+ * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param left The coordinate of the left edge of the window.
+ * \param top The coordinate of the top edge of the window.
+ * \param width The width the window.
+ * \param height The height the window.
+ * \param state The state of the window when opened.
+ * \param type The type of drawing context installed in this window.
+ * \param stereoVisual Create a stereo visual for quad buffered stereo.
+ * \param numOfAASamples Number of samples used for AA (zero if no AA)
+ * \param parentWindow Parent (embedder) window
+ * \return The new window (or 0 if creation failed).
*/
virtual GHOST_IWindow *createWindow(
const STR_String& title,
@@ -252,40 +252,40 @@ public:
/**
* Dispose a window.
- * \param window Pointer to the window to be disposed.
- * \return Indication of success.
+ * \param window Pointer to the window to be disposed.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window) = 0;
/**
* Returns whether a window is valid.
- * \param window Pointer to the window to be checked.
- * \return Indication of validity.
+ * \param window Pointer to the window to be checked.
+ * \return Indication of validity.
*/
virtual bool validWindow(GHOST_IWindow *window) = 0;
/**
* Begins full screen mode.
- * \param setting The new setting of the display.
- * \param window Window displayed in full screen.
- * This window is invalid after full screen has been ended.
- * \return Indication of success.
+ * \param setting The new setting of the display.
+ * \param window Window displayed in full screen.
+ * This window is invalid after full screen has been ended.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0;
-
+
/**
* Updates the resolution while in fullscreen mode.
- * \param setting The new setting of the display.
- * \param window Window displayed in full screen.
+ * \param setting The new setting of the display.
+ * \param window Window displayed in full screen.
*
- * \return Indication of success.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window) = 0;
/**
* Ends full screen mode.
- * \return Indication of success.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess endFullScreen(void) = 0;
@@ -305,7 +305,7 @@ public:
* \return Indication of the presence of events.
*/
virtual bool processEvents(bool waitForEvent) = 0;
-
+
/**
* Retrieves events from the queue and send them to the event consumers.
* \return Indication of the presence of events.
@@ -332,18 +332,18 @@ public:
/**
* Returns the current location of the cursor (location in screen coordinates)
- * \param x The x-coordinate of the cursor.
- * \param y The y-coordinate of the cursor.
- * \return Indication of success.
+ * \param x The x-coordinate of the cursor.
+ * \param y The y-coordinate of the cursor.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
/**
* Updates the location of the cursor (location in screen coordinates).
* Not all operating systems allow the cursor to be moved (without the input device being moved).
- * \param x The x-coordinate of the cursor.
- * \param y The y-coordinate of the cursor.
- * \return Indication of success.
+ * \param x The x-coordinate of the cursor.
+ * \param y The y-coordinate of the cursor.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
@@ -353,17 +353,17 @@ public:
/**
* Returns the state of a modifier key (ouside the message queue).
- * \param mask The modifier key state to retrieve.
- * \param isDown The state of a modifier key (true == pressed).
- * \return Indication of success.
+ * \param mask The modifier key state to retrieve.
+ * \param isDown The state of a modifier key (true == pressed).
+ * \return Indication of success.
*/
virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const = 0;
/**
* Returns the state of a mouse button (ouside the message queue).
- * \param mask The button state to retrieve.
- * \param isDown Button state.
- * \return Indication of success.
+ * \param mask The button state to retrieve.
+ * \param isDown Button state.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
@@ -378,11 +378,11 @@ public:
* \return current status (1 -visible, 0 - hidden)
*/
virtual int toggleConsole(int action) = 0;
-
+
/***************************************************************************************
* Access to clipboard.
***************************************************************************************/
-
+
/**
* Returns the selection buffer
* \return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 7ec6417ca4f..88f130aabe8 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -41,20 +41,20 @@
/**
* Interface for GHOST windows.
*
- * You can create a window with the system's GHOST_ISystem::createWindow
+ * You can create a window with the system's GHOST_ISystem::createWindow
* method.
* \see GHOST_ISystem#createWindow
*
* There are two coordinate systems:
* <ul>
* <li>The screen coordinate system. The origin of the screen is located in the
- * upper left corner of the screen.</li>
+ * upper left corner of the screen.</li>
* <li>The client rectangle coordinate system. The client rectangle of a window
* is the area that is drawable by the application (excluding title bars etc.).
- * </li>
+ * </li>
* </ul>
- * \author Maarten Gribnau
- * \date May 31, 2001
+ * \author Maarten Gribnau
+ * \date May 31, 2001
*/
class GHOST_IWindow
{
@@ -86,20 +86,20 @@ public:
/**
* Tries to install a rendering context in this window.
- * \param type The type of rendering context installed.
+ * \param type The type of rendering context installed.
* \return Indication as to whether installation has succeeded.
*/
virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) = 0;
/**
* Sets the title displayed in the title bar.
- * \param title The title to display in the title bar.
+ * \param title The title to display in the title bar.
*/
virtual void setTitle(const STR_String& title) = 0;
/**
* Returns the title displayed in the title bar.
- * \param title The title displayed in the title bar.
+ * \param title The title displayed in the title bar.
*/
virtual void getTitle(STR_String& title) const = 0;
@@ -109,7 +109,7 @@ public:
* \param bounds The bounding rectangle of the window.
*/
virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
-
+
/**
* Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero.
@@ -131,26 +131,26 @@ public:
/**
* Resizes client rectangle.
- * \param width The new width of the client area of the window.
- * \param height The new height of the client area of the window.
+ * \param width The new width of the client area of the window.
+ * \param height The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
- * \param inX The x-coordinate on the screen.
- * \param inY The y-coordinate on the screen.
- * \param outX The x-coordinate in the client rectangle.
- * \param outY The y-coordinate in the client rectangle.
+ * \param inX The x-coordinate on the screen.
+ * \param inY The y-coordinate on the screen.
+ * \param outX The x-coordinate in the client rectangle.
+ * \param outY The y-coordinate in the client rectangle.
*/
virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
- * \param inX The x-coordinate in the client rectangle.
- * \param inY The y-coordinate in the client rectangle.
- * \param outX The x-coordinate on the screen.
- * \param outY The y-coordinate on the screen.
+ * \param inX The x-coordinate in the client rectangle.
+ * \param inY The y-coordinate in the client rectangle.
+ * \param outX The x-coordinate on the screen.
+ * \param outY The y-coordinate on the screen.
*/
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
@@ -158,13 +158,13 @@ public:
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
virtual void setAcceptDragOperation(bool canAccept) = 0;
-
+
/**
* Returns acceptance of the dropped object
* Usually called by the "object dropped" event handling function
*/
virtual bool canAcceptDragOperation() const = 0;
-
+
/**
* Returns the state of the window (normal, minimized, maximized).
* \return The state of the window.
@@ -184,13 +184,13 @@ public:
* \return Indication of success.
*/
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges) = 0;
-
+
/**
* Gets the window "modified" status, indicating unsaved changes
* \return True if there are unsaved changes
*/
virtual bool getModifiedState() = 0;
-
+
/**
* Sets the order of the window (bottom, top).
* \param order The order of the window.
@@ -200,13 +200,13 @@ public:
/**
* Swaps front and back buffers of a window.
- * \return A boolean success indicator.
+ * \return A boolean success indicator.
*/
virtual GHOST_TSuccess swapBuffers() = 0;
/**
* Activates the drawing context of this window.
- * \return A boolean success indicator.
+ * \return A boolean success indicator.
*/
virtual GHOST_TSuccess activateDrawingContext() = 0;
@@ -215,71 +215,71 @@ public:
* \return Indication of success.
*/
virtual GHOST_TSuccess invalidate() = 0;
-
+
/**
* Returns the window user data.
* \return The window user data.
*/
virtual GHOST_TUserDataPtr getUserData() const = 0;
-
+
/**
* Changes the window user data.
* \param data The window user data.
*/
virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
-
+
/**
* Returns the tablet data (pressure etc).
* \return The tablet data (pressure etc).
*/
virtual const GHOST_TabletData *GetTabletData() = 0;
-
+
/***************************************************************************************
* Progress bar functionality
***************************************************************************************/
-
+
/**
* Sets the progress bar value displayed in the window/application icon
* \param progress The progress %
*/
virtual GHOST_TSuccess setProgressBar(float progress) = 0;
-
+
/**
* Hides the progress bar in the icon
*/
virtual GHOST_TSuccess endProgressBar() = 0;
-
+
/***************************************************************************************
* Cursor management functionality
***************************************************************************************/
/**
* Returns the current cursor shape.
- * \return The current cursor shape.
+ * \return The current cursor shape.
*/
virtual GHOST_TStandardCursor getCursorShape() const = 0;
/**
* Set the shape of the cursor.
- * \param cursor The new cursor shape type id.
- * \return Indication of success.
+ * \param cursor The new cursor shape type id.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
/**
* Set the shape of the cursor to a custom cursor.
- * \param bitmap The bitmap data for the cursor.
- * \param mask The mask data for the cursor.
- * \param hotX The X coordinate of the cursor hotspot.
- * \param hotY The Y coordinate of the cursor hotspot.
- * \return Indication of success.
+ * \param bitmap The bitmap data for the cursor.
+ * \param mask The mask data for the cursor.
+ * \param hotX The X coordinate of the cursor hotspot.
+ * \param hotY The Y coordinate of the cursor hotspot.
+ * \return Indication of success.
*/
- virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
+ virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY) = 0;
- virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
+ virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
@@ -287,21 +287,21 @@ public:
/**
* Returns the visibility state of the cursor.
- * \return The visibility state of the cursor.
+ * \return The visibility state of the cursor.
*/
virtual bool getCursorVisibility() const = 0;
/**
* Shows or hides the cursor.
- * \param visible The new visibility state of the cursor.
- * \return Indication of success.
+ * \param visible The new visibility state of the cursor.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess setCursorVisibility(bool visible) = 0;
/**
* Grabs the cursor for a modal operation.
- * \param grab The new grab state of the cursor.
- * \return Indication of success.
+ * \param grab The new grab state of the cursor.
+ * \return Indication of success.
*/
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds, GHOST_TInt32 mouse_ungrab_xy[2]) { return GHOST_kSuccess; }
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index aa7969d68ad..a055b6f7f0d 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -41,8 +41,8 @@
* The four extreme coordinates are stored as left, top, right and bottom.
* To be valid, a rectangle should have a left coordinate smaller than or equal to right.
* To be valid, a rectangle should have a top coordinate smaller than or equal to bottom.
- * \author Maarten Gribnau
- * \date May 10, 2001
+ * \author Maarten Gribnau
+ * \date May 10, 2001
*/
class GHOST_Rect {
@@ -50,10 +50,10 @@ public:
/**
* Constructs a rectangle with the given values.
- * \param l requested left coordinate of the rectangle
- * \param t requested top coordinate of the rectangle
- * \param r requested right coordinate of the rectangle
- * \param b requested bottom coordinate of the rectangle
+ * \param l requested left coordinate of the rectangle
+ * \param t requested top coordinate of the rectangle
+ * \param r requested right coordinate of the rectangle
+ * \param b requested bottom coordinate of the rectangle
*/
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
: m_l(l), m_t(t), m_r(r), m_b(b)
@@ -61,12 +61,12 @@ public:
/**
* Copy constructor.
- * \param r rectangle to copy
+ * \param r rectangle to copy
*/
GHOST_Rect(const GHOST_Rect& r)
: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b)
{}
-
+
/**
* Destructor.
*/
@@ -74,71 +74,71 @@ public:
/**
* Access to rectangle width.
- * \return width of the rectangle
+ * \return width of the rectangle
*/
virtual inline GHOST_TInt32 getWidth() const;
/**
* Access to rectangle height.
- * \return height of the rectangle
+ * \return height of the rectangle
*/
virtual inline GHOST_TInt32 getHeight() const;
/**
* Sets all members of the rectangle.
- * \param l requested left coordinate of the rectangle
- * \param t requested top coordinate of the rectangle
- * \param r requested right coordinate of the rectangle
- * \param b requested bottom coordinate of the rectangle
+ * \param l requested left coordinate of the rectangle
+ * \param t requested top coordinate of the rectangle
+ * \param r requested right coordinate of the rectangle
+ * \param b requested bottom coordinate of the rectangle
*/
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
* Empty rectangles are rectangles that have width==0 and/or height==0.
- * \return boolean value (true==empty rectangle)
+ * \return boolean value (true==empty rectangle)
*/
virtual inline bool isEmpty() const;
/**
* Returns whether this rectangle is valid.
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.
- * \return boolean value (true==valid rectangle)
+ * \return boolean value (true==valid rectangle)
*/
virtual inline bool isValid() const;
/**
* Grows (or shrinks the rectangle).
* The method avoids negative insets making the rectangle invalid
- * \param i The amount of offset given to each extreme (negative values shrink the rectangle).
+ * \param i The amount of offset given to each extreme (negative values shrink the rectangle).
*/
virtual void inset(GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
* The result is stored in this rectangle.
- * \param r The rectangle that is input for the union operation.
+ * \param r The rectangle that is input for the union operation.
*/
virtual inline void unionRect(const GHOST_Rect& r);
/**
* Grows the rectangle to included a point.
- * \param x The x-coordinate of the point.
- * \param y The y-coordinate of the point.
+ * \param x The x-coordinate of the point.
+ * \param y The y-coordinate of the point.
*/
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Grows the rectangle to included a point.
- * \param x The x-coordinate of the point.
- * \param y The y-coordinate of the point.
+ * \param x The x-coordinate of the point.
+ * \param y The y-coordinate of the point.
*/
virtual inline void wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs);
/**
* Returns whether the point is inside this rectangle.
* Point on the boundary is considered inside.
- * \param x x-coordinate of point to test.
+ * \param x x-coordinate of point to test.
* \param y y-coordinate of point to test.
* \return boolean value (true if point is inside).
*/
@@ -146,16 +146,16 @@ public:
/**
* Returns whether the rectangle is inside this rectangle.
- * \param r rectangle to test.
- * \return visibility (not, partially or fully visible).
+ * \param r rectangle to test.
+ * \return visibility (not, partially or fully visible).
*/
virtual GHOST_TVisibility getVisibility(GHOST_Rect& r) const;
/**
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location.
- * \param cx requested center x-coordinate of the rectangle
- * \param cy requested center y-coordinate of the rectangle
+ * \param cx requested center x-coordinate of the rectangle
+ * \param cy requested center y-coordinate of the rectangle
*/
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
@@ -163,10 +163,10 @@ public:
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location,
* with the width requested.
- * \param cx requested center x-coordinate of the rectangle
- * \param cy requested center y-coordinate of the rectangle
- * \param w requested width of the rectangle
- * \param h requested height of the rectangle
+ * \param cx requested center x-coordinate of the rectangle
+ * \param cy requested center y-coordinate of the rectangle
+ * \param w requested width of the rectangle
+ * \param h requested height of the rectangle
*/
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
@@ -174,8 +174,8 @@ public:
* Clips a rectangle.
* Updates the rectangle given such that it will fit within this one.
* This can result in an empty rectangle.
- * \param r the rectangle to clip
- * \return whether clipping has occurred
+ * \param r the rectangle to clip
+ * \return whether clipping has occurred
*/
virtual bool clip(GHOST_Rect& r) const;
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 9b563ef7e55..868d787b5f9 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -388,7 +388,7 @@ typedef struct {
typedef struct {
/** Displacement of a mouse wheel. */
- GHOST_TInt32 z;
+ GHOST_TInt32 z;
} GHOST_TEventWheelData;
typedef enum {
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
index c5a2fecd3b8..555f883cbf2 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
@@ -102,7 +102,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(GHOST_TUns8 d
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(): only main display is supported");
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (display == kMainDisplay) //Screen #0 may not be the main one
askedDisplay = [NSScreen mainScreen];
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index 3d702c02b0f..754218191a5 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -88,7 +88,7 @@ getNumDisplaySettings(
#else
/* We only have one X11 setting at the moment. */
- GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
+ GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings = 1;
#endif
@@ -130,8 +130,8 @@ getDisplaySetting(
setting.bpp = DefaultDepth(dpy, DefaultScreen(dpy));
#else
- GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
- GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
+ GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
+ GHOST_ASSERT(index < 1, "Requested setting outside of valid range.\n");
Display *x_display = m_system->getXDisplay();
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index cef9bb0a34a..c51f9568087 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -72,13 +72,13 @@ class GHOST_EventDragnDrop : public GHOST_Event
public:
/**
* Constructor.
- * \param time The time this event was generated.
- * \param type The type of this event.
- * \param dataType The type of the drop candidate object
- * \param window The window where the event occurred
- * \param x The x-coordinate of the location the cursor was at at the time of the event.
- * \param y The y-coordinate of the location the cursor was at at the time of the event.
- * \param data The "content" dropped in the window
+ * \param time The time this event was generated.
+ * \param type The type of this event.
+ * \param dataType The type of the drop candidate object
+ * \param window The window where the event occurred
+ * \param x The x-coordinate of the location the cursor was at at the time of the event.
+ * \param y The y-coordinate of the location the cursor was at at the time of the event.
+ * \param data The "content" dropped in the window
*/
GHOST_EventDragnDrop(GHOST_TUns64 time,
GHOST_TEventType type,
diff --git a/intern/ghost/intern/GHOST_Rect.cpp b/intern/ghost/intern/GHOST_Rect.cpp
index dc30b3eb220..9af4f30ebc1 100644
--- a/intern/ghost/intern/GHOST_Rect.cpp
+++ b/intern/ghost/intern/GHOST_Rect.cpp
@@ -75,7 +75,7 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect& r) const
GHOST_TVisibility v;
if (lt && rt && lb && rb) {
// All points inside, rectangle is inside this
- v = GHOST_kFullyVisible;
+ v = GHOST_kFullyVisible;
}
else if (!(lt || rt || lb || rb)) {
// None of the points inside
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 070bf914dda..d2e3377f6ce 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -206,7 +206,7 @@ public:
***************************************************************************************/
/** Inherited from GHOST_ISystem but left pure virtual
- * GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
+ * GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
* GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
*/
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index bb68ce8889c..f5784c7d451 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -126,7 +126,7 @@ static GHOST_TKey convertKey(int rawCode)
*/
static UInt32 dummy = 0;
Handle transData = (Handle) GetScriptManagerVariable(smKCHRCache);
- unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
+ unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
/* Map numpad based on rawcodes first, otherwise they
* look like non-numpad events.
* Added too: mapping the number keys, for french keyboards etc (ton)
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index fed3bdbc8f0..7c3e2f35ac9 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -966,7 +966,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
//Resend event to NSApp to ensure Mac wide events are handled
[NSApp sendEvent:event];
[pool drain];
- } while (event!= nil);
+ } while (event != nil);
#if 0
} while (waitForEvent && !anyProcessed); // Needed only for timer implementation
#endif
@@ -1000,16 +1000,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent()
modifiers = [[[NSApplication sharedApplication] currentEvent] modifierFlags];
if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSShiftKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift));
}
if ((modifiers & NSControlKeyMask) != (m_modifierMask & NSControlKeyMask)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSControlKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSControlKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl));
}
if ((modifiers & NSAlternateKeyMask) != (m_modifierMask & NSAlternateKeyMask)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSAlternateKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt));
}
if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
- pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
+ pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS));
}
m_modifierMask = modifiers;
@@ -1052,7 +1052,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
case GHOST_kEventWindowSize:
if (!m_ignoreWindowSizedMessages)
{
- //Enforce only one resize message per event loop (coalescing all the live resize messages)
+ //Enforce only one resize message per event loop (coalescing all the live resize messages)
window->updateDrawingContext();
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
//Mouse up event is trapped by the resizing event loop, so send it anyway to the window manager
@@ -1089,7 +1089,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
GHOST_TUns8 * temp_buff;
GHOST_TStringArray *strArray;
NSArray *droppedArray;
- size_t pastedTextSize;
+ size_t pastedTextSize;
NSString *droppedStr;
GHOST_TEventDataPtr eventData;
int i;
@@ -1126,7 +1126,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
strArray->strings[i] = temp_buff;
}
- eventData = (GHOST_TEventDataPtr) strArray;
+ eventData = (GHOST_TEventDataPtr) strArray;
break;
case GHOST_kDragnDropTypeString:
@@ -1326,7 +1326,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
int confirmOpen = NSAlertAlternateReturn;
NSArray *windowsList;
char * temp_buff;
- size_t filenameTextSize;
+ size_t filenameTextSize;
GHOST_Window* window= (GHOST_Window*)m_windowManager->getActiveWindow();
if (!window) {
@@ -1460,7 +1460,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
- pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
//Handle tablet events combined with mouse events
handleTabletEvent(event);
break;
@@ -1468,14 +1468,14 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
- pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
+ pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
//Handle tablet events combined with mouse events
handleTabletEvent(event);
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
- case NSOtherMouseDragged:
+ case NSOtherMouseDragged:
//Handle tablet events combined with mouse events
handleTabletEvent(event);
@@ -1503,7 +1503,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
window->setCursorGrabAccum(x_accum, y_accum);
window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y);
- pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
}
break;
case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
@@ -1548,7 +1548,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
//Post event
window->getCursorGrabInitPos(x_cur, y_cur);
window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
- pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
}
break;
default:
@@ -1558,7 +1558,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
- pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x, y));
+ pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
m_cursorDelta_x=0;
m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
@@ -1580,7 +1580,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if (deltaF == 0.0) break; //discard trackpad delta=0 events
delta = deltaF > 0.0 ? 1 : -1;
- pushEvent(new GHOST_EventWheel([event timestamp]*1000, window, delta));
+ pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta));
}
else {
NSPoint mousePos = [event locationInWindow];
@@ -1604,7 +1604,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
dy = -dy;
- pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
+ pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
}
}
break;
@@ -1614,8 +1614,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
NSPoint mousePos = [event locationInWindow];
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
- pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, x, y,
- [event magnification]*125.0 + 0.1, 0));
+ pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventMagnify, x, y,
+ [event magnification] * 125.0 + 0.1, 0));
}
break;
@@ -1624,8 +1624,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
NSPoint mousePos = [event locationInWindow];
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
- pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, x, y,
- -[event rotation] * 5.0, 0));
+ pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventRotate, x, y,
+ -[event rotation] * 5.0, 0));
}
case NSEventTypeBeginGesture:
m_isGestureInProgress = true;
@@ -1700,11 +1700,11 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
break; //Cmd-Q is directly handled by Cocoa
if ([event type] == NSKeyDown) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
+ pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
//printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
}
else {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') );
+ pushEvent( new GHOST_EventKey([event timestamp] * 1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') );
//printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
}
break;
@@ -1713,16 +1713,16 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
modifiers = [event modifierFlags];
if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
+ pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSShiftKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift));
}
if ((modifiers & NSControlKeyMask) != (m_modifierMask & NSControlKeyMask)) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSControlKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
+ pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSControlKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl));
}
if ((modifiers & NSAlternateKeyMask) != (m_modifierMask & NSAlternateKeyMask)) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSAlternateKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
+ pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSAlternateKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt));
}
if ((modifiers & NSCommandKeyMask) != (m_modifierMask & NSCommandKeyMask)) {
- pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSCommandKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
+ pushEvent(new GHOST_EventKey([event timestamp] * 1000, (modifiers & NSCommandKeyMask) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS));
}
m_modifierMask = modifiers;
@@ -1743,7 +1743,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
{
GHOST_TUns8 * temp_buff;
- size_t pastedTextSize;
+ size_t pastedTextSize;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 3ba84e157ed..c9953c80a52 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -858,7 +858,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
case DestroyNotify:
- ::exit(-1);
+ ::exit(-1);
/* We're not interested in the following things.(yet...) */
case NoExpose:
case GraphicsExpose:
@@ -1171,7 +1171,7 @@ generateWindowExposeEvents()
*w_start
);
- (*w_start)->validate();
+ (*w_start)->validate();
if (g_event) {
pushEvent(g_event);
@@ -1603,7 +1603,7 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
Window m_window, owner;
- vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
+ vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
GHOST_WindowX11 *window = static_cast<GHOST_WindowX11 *>(*win_it);
m_window = window->getXWindow();
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index bc556490d12..02c0109085a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -230,7 +230,7 @@ public:
/**
* Puts buffer to system clipboard
- * \param buffer The buffer to copy to the clipboard
+ * \param buffer The buffer to copy to the clipboard
* \param selection Set the selection into the clipboard, X11 only feature
*/
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 2077afd4086..23eefe17959 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -187,7 +187,7 @@ extern "C" {
NSPoint mouseLocation = [sender draggingLocation];
systemCocoa->handleDraggingEvent(GHOST_kEventDraggingUpdated, m_draggedObjectType, associatedWindow, mouseLocation.x, mouseLocation.y, nil);
- return associatedWindow->canAcceptDragOperation()?NSDragOperationCopy:NSDragOperationNone;
+ return associatedWindow->canAcceptDragOperation() ? NSDragOperationCopy : NSDragOperationNone;
}
- (void)draggingExited:(id < NSDraggingInfo >)sender
@@ -368,7 +368,7 @@ extern "C" {
- (BOOL)hasMarkedText
{
- return (composing)? YES: NO;
+ return (composing) ? YES : NO;
}
- (void)doCommandBySelector:(SEL)selector
@@ -392,7 +392,7 @@ extern "C" {
- (NSRange)markedRange
{
- unsigned int length = (composing_text)? [composing_text length]: 0;
+ unsigned int length = (composing_text) ? [composing_text length] : 0;
if (composing)
return NSMakeRange(0, length);
@@ -402,7 +402,7 @@ extern "C" {
- (NSRange)selectedRange
{
- unsigned int length = (composing_text)? [composing_text length]: 0;
+ unsigned int length = (composing_text) ? [composing_text length] : 0;
return NSMakeRange(0, length);
}
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index c9c902fca8b..dded7dc256d 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -720,7 +720,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
};
// Get the function
- PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
+ PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (!wglChoosePixelFormatARB)
{
diff --git a/intern/ghost/test/multitest/EventToBuf.c b/intern/ghost/test/multitest/EventToBuf.c
index aba80784a72..49255de5e64 100644
--- a/intern/ghost/test/multitest/EventToBuf.c
+++ b/intern/ghost/test/multitest/EventToBuf.c
@@ -197,15 +197,15 @@ static char *keytype_to_string(GHOST_TKey key)
void event_to_buf(GHOST_EventHandle evt, char buf[128])
{
- GHOST_TEventType type= GHOST_GetEventType(evt);
- double time= (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
- GHOST_WindowHandle win= GHOST_GetEventWindow(evt);
- void *data= GHOST_GetEventData(evt);
- char *pos= buf;
+ GHOST_TEventType type = GHOST_GetEventType(evt);
+ double time = (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
+ GHOST_WindowHandle win = GHOST_GetEventWindow(evt);
+ void *data = GHOST_GetEventData(evt);
+ char *pos = buf;
pos += sprintf(pos, "event: %6.2f, %16s", time, eventtype_to_string(type));
if (win) {
- char *s= GHOST_GetTitle(win);
+ char *s = GHOST_GetTitle(win);
pos += sprintf(pos, " - win: %s", s);
free(s);
}
@@ -215,14 +215,14 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
switch (type) {
case GHOST_kEventCursorMove:
{
- GHOST_TEventCursorData *cd= data;
+ GHOST_TEventCursorData *cd = data;
pos += sprintf(pos, " - pos: (%d, %d)", cd->x, cd->y);
break;
}
case GHOST_kEventButtonDown:
case GHOST_kEventButtonUp:
{
- GHOST_TEventButtonData *bd= data;
+ GHOST_TEventButtonData *bd = data;
pos += sprintf(pos, " - but: %d", bd->button);
break;
}
@@ -230,7 +230,7 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
case GHOST_kEventKeyDown:
case GHOST_kEventKeyUp:
{
- GHOST_TEventKeyData *kd= data;
+ GHOST_TEventKeyData *kd = data;
pos += sprintf(pos, " - key: %s (%d)", keytype_to_string(kd->key), kd->key);
if (kd->ascii) pos+= sprintf(pos, " ascii: '%c' (%d)", kd->ascii, kd->ascii);
break;
diff --git a/intern/itasc/Scene.cpp b/intern/itasc/Scene.cpp
index 7a83f821bf0..7ed8fc4e63c 100644
--- a/intern/itasc/Scene.cpp
+++ b/intern/itasc/Scene.cpp
@@ -40,7 +40,7 @@ public:
{
q_nr += m_qrange.start;
project(m_scene->m_Wq, Range(q_nr, ndof), m_qrange).setZero();
- // update the ouput vector so that the movement of this joint will be
+ // update the output vector so that the movement of this joint will be
// taken into account and we can put the joint back in its initial position
// which means that the jacobian doesn't need to be changed
for (unsigned int i=0 ;i<ndof ; ++i, ++q_nr) {
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h
index 1ae5e9df1c6..c05c9d61ea2 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -80,7 +80,7 @@ void delete_MEM_CacheLimiter(MEM_CacheLimiterC *This);
* @return CacheLimiterHandle to ref, unref, touch the managed object
*/
-MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC * This, void * data);
+MEM_CacheLimiterHandleC *MEM_CacheLimiter_insert(MEM_CacheLimiterC *This, void *data);
/**
* Free objects until memory constraints are satisfied
@@ -140,7 +140,7 @@ int MEM_CacheLimiter_get_refcount(MEM_CacheLimiterHandleC *handle);
* @param handle of object
*/
-void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
+void *MEM_CacheLimiter_get(MEM_CacheLimiterHandleC *handle);
void MEM_CacheLimiter_ItemPriority_Func_set(MEM_CacheLimiterC *This,
MEM_CacheLimiter_ItemPriority_Func item_priority_func);
diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
index 81a1ce670ae..7a19543b2db 100644
--- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
+++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
@@ -59,9 +59,9 @@ public:
}
~MEM_CacheLimiterCClass();
- handle_t * insert(void * data);
+ handle_t * insert(void *data);
- void destruct(void * data, list_t::iterator it);
+ void destruct(void *data, list_t::iterator it);
cache_t * get_cache() {
return &cache;
@@ -76,7 +76,7 @@ private:
class MEM_CacheLimiterHandleCClass {
public:
- MEM_CacheLimiterHandleCClass(void * data_, MEM_CacheLimiterCClass * parent_) :
+ MEM_CacheLimiterHandleCClass(void *data_, MEM_CacheLimiterCClass *parent_) :
data(data_),
parent(parent_)
{ }
@@ -87,7 +87,7 @@ public:
it = it_;
}
- void set_data(void * data_) {
+ void set_data(void *data_) {
data = data_;
}
@@ -101,7 +101,7 @@ private:
list_t::iterator it;
};
-handle_t *MEM_CacheLimiterCClass::insert(void * data)
+handle_t *MEM_CacheLimiterCClass::insert(void *data)
{
cclass_list.push_back(new MEM_CacheLimiterHandleCClass(data, this));
list_t::iterator it = cclass_list.end();
@@ -111,7 +111,7 @@ handle_t *MEM_CacheLimiterCClass::insert(void * data)
return cache.insert(cclass_list.back());
}
-void MEM_CacheLimiterCClass::destruct(void * data, list_t::iterator it)
+void MEM_CacheLimiterCClass::destruct(void *data, list_t::iterator it)
{
data_destructor(data);
cclass_list.erase(it);
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript
index 711955cbfeb..a0f02735748 100644
--- a/intern/opennl/SConscript
+++ b/intern/opennl/SConscript
@@ -5,8 +5,5 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c')
incs = 'extern superlu ../../extern/colamd/Include'
-if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')):
- env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] )
-else:
- env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['core'], priority=[55] )
+env.BlenderLib ('bf_intern_opennl', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
diff --git a/intern/raskter/raskter.c b/intern/raskter/raskter.c
index c79bcc4a76d..21153082324 100644
--- a/intern/raskter/raskter.c
+++ b/intern/raskter/raskter.c
@@ -113,7 +113,7 @@ static void preprocess_all_edges(struct r_FillContext *ctx,
ctx->rb.xmin = xbeg;
}
if (ybeg >= ctx->rb.ymax) {
- ctx->rb.ymax= ybeg;
+ ctx->rb.ymax = ybeg;
}
else if (ybeg <= ctx->rb.ymin) {
ctx->rb.ymin=ybeg;
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index e51c3176699..3dce804c543 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -46,7 +46,7 @@ extern "C" FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, i
extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, int use_fire, int use_colors)
{
- if(amplify)
+ if (amplify)
return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype, use_fire, use_colors);
else
return NULL;
@@ -105,8 +105,7 @@ extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
static void data_dissolve(float *density, float *heat, float *r, float *g, float *b, int total_cells, int speed, int log)
{
- if(log)
- {
+ if (log) {
/* max density/speed = dydx */
float fac = 1.0f - (1.0f / (float)speed);
@@ -138,14 +137,14 @@ static void data_dissolve(float *density, float *heat, float *r, float *g, float
float d = density[i];
/* density */
density[i] -= dydx;
- if(density[i] < 0.0f)
+ if (density[i] < 0.0f)
density[i] = 0.0f;
/* heat */
if (heat) {
- if(abs(heat[i]) < dydx) heat[i] = 0.0f;
- else if (heat[i]>0.0f) heat[i] -= dydx;
- else if (heat[i]<0.0f) heat[i] += dydx;
+ if (abs(heat[i]) < dydx) heat[i] = 0.0f;
+ else if (heat[i] > 0.0f) heat[i] -= dydx;
+ else if (heat[i] < 0.0f) heat[i] += dydx;
}
/* color */
@@ -190,9 +189,9 @@ extern "C" void smoke_export(FLUID_3D *fluid, float *dt, float *dx, float **dens
}
extern "C" void smoke_turbulence_export(WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
- float **r, float **g, float **b , float **tcu, float **tcv, float **tcw)
+ float **r, float **g, float **b , float **tcu, float **tcv, float **tcw)
{
- if(!wt)
+ if (!wt)
return;
*dens = wt->_densityBig;
@@ -484,4 +483,4 @@ extern "C" void smoke_ensure_colors(FLUID_3D *fluid, WTURBULENCE *wt, float init
if (wt) {
wt->initColors(init_r, init_g, init_b);
}
-} \ No newline at end of file
+}
diff --git a/intern/smoke/intern/spectrum.cpp b/intern/smoke/intern/spectrum.cpp
index 359f3ab73a9..30433451ac2 100644
--- a/intern/smoke/intern/spectrum.cpp
+++ b/intern/smoke/intern/spectrum.cpp
@@ -385,7 +385,7 @@ static void lms_to_xyz(double l, double m, double s, double* x, double *y, doubl
*z = s;
}
-void spectrum(double t1, double t2, int N, unsigned char* d)
+void spectrum(double t1, double t2, int N, unsigned char *d)
{
int i,j,dj;
double X,Y,Z,R,G,B,L,M,S, Lw, Mw, Sw;
diff --git a/intern/smoke/intern/spectrum.h b/intern/smoke/intern/spectrum.h
index 9edd9ad887c..3ffd41f9517 100644
--- a/intern/smoke/intern/spectrum.h
+++ b/intern/smoke/intern/spectrum.h
@@ -1,6 +1,6 @@
#ifndef __SPECTRUM_H
#define __SPECTRUM_H
-void spectrum(double t1, double t2, int n, unsigned char* d);
+void spectrum(double t1, double t2, int n, unsigned char *d);
#endif