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:
authorJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
committerJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
commita68a7f42b02ad0260220d94f36ab61c772db071a (patch)
tree620b763cd24fbfc1259f00ccb005217914af0c6f /intern
parent526d0bec4722900a86d81ff0f5d71504b2b4ad8c (diff)
parent15215493bf9d1d08e650109e6eb6189fc76e289e (diff)
resolved conflict state with HEAD r14096
blenderbuttons still bad not let this compile
Diffstat (limited to 'intern')
-rw-r--r--intern/SoundSystem/SConscript9
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.cpp12
-rw-r--r--intern/action/ACT_Action.h141
-rw-r--r--intern/action/ACT_ActionC-Api.h193
-rw-r--r--intern/action/ACT_ActionStack.h185
-rw-r--r--intern/action/Makefile52
-rw-r--r--intern/action/doc/Doxyfile746
-rw-r--r--intern/action/intern/ACT_Action.cpp68
-rw-r--r--intern/action/intern/ACT_ActionC-Api.cpp134
-rw-r--r--intern/action/intern/ACT_ActionStack.cpp245
-rw-r--r--intern/action/intern/ACT_CallbackAction.h125
-rw-r--r--intern/action/intern/Makefile42
-rw-r--r--intern/action/make/msvc_6_0/action.dsp128
-rw-r--r--intern/action/make/msvc_6_0/action.dsw29
-rw-r--r--intern/action/make/msvc_7_0/action.sln21
-rw-r--r--intern/action/make/msvc_7_0/action.vcproj145
-rw-r--r--intern/action/test/action_c_test/ActionTest.c87
-rw-r--r--intern/action/test/action_c_test/TestAction.c63
-rw-r--r--intern/action/test/action_c_test/TestAction.h51
-rw-r--r--intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp109
-rw-r--r--intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw44
-rw-r--r--intern/action/test/action_cpp_test/ActionTest.cpp87
-rw-r--r--intern/action/test/action_cpp_test/TestAction.h58
-rw-r--r--intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp105
-rw-r--r--intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw44
-rw-r--r--intern/bmfont/BMF_Api.h37
-rw-r--r--intern/bmfont/intern/BMF_Api.cpp22
-rw-r--r--intern/bmfont/intern/BMF_BitmapFont.cpp118
-rw-r--r--intern/bmfont/intern/BMF_BitmapFont.h35
-rw-r--r--intern/boolop/intern/BOP_BSPNode.cpp100
-rw-r--r--intern/boolop/intern/BOP_BSPNode.h7
-rw-r--r--intern/boolop/intern/BOP_BSPTree.cpp43
-rw-r--r--intern/boolop/intern/BOP_BSPTree.h1
-rw-r--r--intern/boolop/intern/BOP_Face.cpp10
-rw-r--r--intern/boolop/intern/BOP_Face.h13
-rw-r--r--intern/boolop/intern/BOP_Face2Face.cpp116
-rw-r--r--intern/boolop/intern/BOP_Interface.cpp4
-rw-r--r--intern/boolop/intern/BOP_MathUtils.cpp68
-rw-r--r--intern/boolop/intern/BOP_MathUtils.h16
-rw-r--r--intern/boolop/intern/BOP_Merge.cpp6
-rw-r--r--intern/boolop/intern/BOP_Mesh.cpp45
-rw-r--r--intern/boolop/intern/BOP_Triangulator.cpp53
-rw-r--r--[-rwxr-xr-x]intern/bsp/intern/BSP_CSGMesh_CFIterator.h7
-rw-r--r--intern/csg/SConscript8
-rw-r--r--intern/csg/extern/CSG_Interface.h434
-rw-r--r--intern/csg/intern/CSG_BBox.h206
-rw-r--r--intern/csg/intern/CSG_BBoxTree.cpp125
-rw-r--r--intern/csg/intern/CSG_BBoxTree.h135
-rw-r--r--intern/csg/intern/CSG_BlenderVProp.h94
-rw-r--r--intern/csg/intern/CSG_BooleanOp.h88
-rw-r--r--intern/csg/intern/CSG_BooleanOp.inl235
-rw-r--r--intern/csg/intern/CSG_CVertex.h104
-rw-r--r--intern/csg/intern/CSG_ConnectedMesh.h95
-rw-r--r--intern/csg/intern/CSG_ConnectedMeshWrapper.inl210
-rw-r--r--intern/csg/intern/CSG_GeometryBinder.h72
-rw-r--r--intern/csg/intern/CSG_IndexDefs.h42
-rw-r--r--intern/csg/intern/CSG_Math.h152
-rw-r--r--intern/csg/intern/CSG_Math.inl362
-rw-r--r--intern/csg/intern/CSG_Mesh.h66
-rw-r--r--intern/csg/intern/CSG_MeshCopier.h45
-rw-r--r--intern/csg/intern/CSG_MeshWrapper.h110
-rw-r--r--intern/csg/intern/CSG_MeshWrapper.inl150
-rw-r--r--intern/csg/intern/CSG_Polygon.h93
-rw-r--r--intern/csg/intern/CSG_SplitFunction.h188
-rw-r--r--intern/csg/intern/CSG_TreeQueries.h158
-rw-r--r--intern/csg/intern/CSG_Triangulate.h96
-rw-r--r--intern/csg/intern/CSG_Triangulate.inl232
-rw-r--r--intern/csg/intern/CSG_Vertex.h56
-rw-r--r--intern/csg/intern/MT_Line3.cpp81
-rw-r--r--intern/csg/intern/MT_Line3.h109
-rw-r--r--intern/csg/intern/blender/CSG_BlenderMesh.h45
-rw-r--r--intern/csg/intern/blender/CSG_BlenderVProp.cpp35
-rw-r--r--intern/csg/intern/blender/CSG_CsgOp.cpp257
-rw-r--r--intern/csg/intern/blender/CSG_CsgOp.h59
-rw-r--r--intern/csg/intern/blender/CSG_IndexDefs.h22
-rw-r--r--intern/csg/intern/blender/CSG_Interface.cpp193
-rw-r--r--intern/csg/intern/blender/CSG_Iterator.h199
-rw-r--r--intern/csg/intern/blender/CSG_MeshBuilder.h123
-rw-r--r--intern/csg/intern/blender/CSG_PropArray.h126
-rw-r--r--intern/csg/intern/blender/CSG_SimpleProp.cpp4
-rw-r--r--intern/csg/intern/blender/CSG_SimpleProp.h58
-rw-r--r--intern/csg/make/msvc60/csg.dsp234
-rw-r--r--intern/csg/make/msvc60/csg.dsw29
-rw-r--r--intern/elbeem/CMakeLists.txt4
-rw-r--r--intern/elbeem/SConscript6
-rw-r--r--intern/elbeem/extern/elbeem.h2
-rw-r--r--intern/elbeem/intern/attributes.cpp1
-rw-r--r--intern/elbeem/intern/elbeem.h2
-rw-r--r--intern/elbeem/intern/isosurface.cpp3
-rw-r--r--intern/elbeem/intern/loop_tools.h81
-rw-r--r--intern/elbeem/intern/ntl_geometryobject.cpp2
-rw-r--r--intern/elbeem/intern/ntl_vector3dim.h3
-rw-r--r--intern/elbeem/intern/paraloopend.h42
-rw-r--r--intern/elbeem/intern/parametrizer.cpp2
-rw-r--r--intern/elbeem/intern/particletracer.cpp1
-rw-r--r--intern/elbeem/intern/simulation_object.cpp5
-rw-r--r--intern/elbeem/intern/solver_adap.cpp4
-rw-r--r--intern/elbeem/intern/solver_class.h5
-rw-r--r--intern/elbeem/intern/solver_init.cpp55
-rw-r--r--intern/elbeem/intern/solver_interface.cpp7
-rw-r--r--intern/elbeem/intern/solver_interface.h6
-rw-r--r--intern/elbeem/intern/solver_main.cpp24
-rw-r--r--intern/elbeem/intern/solver_util.cpp1
-rw-r--r--intern/elbeem/intern/utilities.cpp6
-rw-r--r--intern/elbeem/intern/utilities.h2
-rw-r--r--intern/ghost/GHOST_C-api.h12
-rw-r--r--intern/ghost/GHOST_ISystem.h12
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp13
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.cpp2
-rw-r--r--intern/ghost/intern/GHOST_System.h15
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp68
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h18
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp59
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h14
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_SystemX11.cpp171
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_SystemX11.h15
-rw-r--r--[-rwxr-xr-x]intern/ghost/intern/GHOST_WindowX11.cpp27
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h7
-rw-r--r--intern/guardedalloc/intern/mallocn.c131
-rw-r--r--intern/iksolver/extern/IK_solver.h2
-rw-r--r--intern/iksolver/intern/IK_QJacobian.cpp3
-rw-r--r--intern/iksolver/intern/IK_QJacobian.h4
-rw-r--r--intern/iksolver/intern/IK_QJacobianSolver.cpp172
-rw-r--r--intern/iksolver/intern/IK_QJacobianSolver.h26
-rw-r--r--intern/iksolver/intern/IK_QSegment.cpp47
-rw-r--r--intern/iksolver/intern/IK_QSegment.h9
-rw-r--r--intern/iksolver/intern/IK_QTask.h9
-rw-r--r--intern/iksolver/intern/IK_Solver.cpp35
-rw-r--r--intern/iksolver/intern/TNT/svd.h9
-rw-r--r--intern/keymaker/Makefile92
-rw-r--r--intern/keymaker/blenkey.h83
-rw-r--r--intern/keymaker/key.c496
-rw-r--r--intern/keymaker/key_internal.h92
-rw-r--r--intern/keymaker/keyloader.c319
-rw-r--r--intern/keymaker/make/msvc_6_0/blenkey.dsp134
-rw-r--r--intern/keymaker/make/msvc_6_0/blenkey.dsw29
-rw-r--r--intern/keymaker/make/msvc_7_0/blenkey.sln21
-rw-r--r--intern/keymaker/make/msvc_7_0/blenkey.vcproj282
-rw-r--r--intern/keymaker/mt19937int.c134
-rw-r--r--intern/keymaker/mt19937int.h46
-rw-r--r--intern/keymaker/python/key_pyc.h154
-rw-r--r--intern/make/msvc_7_0/intern.sln15
-rw-r--r--intern/memutil/MEM_CacheLimiter.h3
-rw-r--r--[-rwxr-xr-x]intern/moto/include/MT_Matrix3x3.h20
-rw-r--r--intern/moto/include/MT_Vector3.h1
-rw-r--r--intern/moto/include/MT_Vector4.h1
-rw-r--r--intern/moto/include/MT_assert.h2
-rw-r--r--intern/moto/intern/MT_Assert.cpp2
-rw-r--r--intern/opennl/SConscript4
-rw-r--r--intern/opennl/extern/ONL_opennl.h35
-rw-r--r--intern/opennl/intern/opennl.c526
-rw-r--r--intern/string/STR_String.h4
-rw-r--r--intern/string/intern/STR_String.cpp1
153 files changed, 1953 insertions, 10441 deletions
diff --git a/intern/SoundSystem/SConscript b/intern/SoundSystem/SConscript
index a9c1110c09a..baf680f03f0 100644
--- a/intern/SoundSystem/SConscript
+++ b/intern/SoundSystem/SConscript
@@ -7,10 +7,11 @@ sources = env.Glob('dummy/*.cpp') + env.Glob('intern/*.cpp')
incs = '. intern ../moto/include ../string dummy openal sdl'
defs = ''
if env['WITH_BF_OPENAL']:
- sources += env.Glob('openal/*.cpp') + env.Glob('sdl/*.cpp')
- incs += ' ' + env['BF_OPENAL_INC']
- incs += ' ' + env['BF_SDL_INC']
+ sources += env.Glob('openal/*.cpp') + env.Glob('sdl/*.cpp')
+ incs += ' ' + env['BF_OPENAL_INC']
+ incs += ' ' + env['BF_SDL_INC']
+ defs = 'USE_OPENAL'
else:
- defs = 'NO_SOUND'
+ defs = 'NO_SOUND'
env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [20,140] )
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
index a278384dfd8..bb0204af53b 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
@@ -332,12 +332,6 @@ SND_OpenALDevice::~SND_OpenALDevice()
{
MakeCurrent();
- if (m_buffersinitialized)
- {
- alDeleteBuffers(NUM_BUFFERS, m_buffers);
- m_buffersinitialized = false;
- }
-
if (m_sourcesinitialized)
{
for (int i = 0; i < NUM_SOURCES; i++)
@@ -347,6 +341,12 @@ SND_OpenALDevice::~SND_OpenALDevice()
m_sourcesinitialized = false;
}
+ if (m_buffersinitialized)
+ {
+ alDeleteBuffers(NUM_BUFFERS, m_buffers);
+ m_buffersinitialized = false;
+ }
+
if (m_context) {
MakeCurrent();
#ifdef AL_VERSION_1_1
diff --git a/intern/action/ACT_Action.h b/intern/action/ACT_Action.h
deleted file mode 100644
index 876ca2bc6b9..00000000000
--- a/intern/action/ACT_Action.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifndef _H_ACT_ACTION_H_
-#define _H_ACT_ACTION_H_
-
-#include "MEM_RefCounted.h"
-#include "STR_String.h"
-
-/**
- * An action that can be applied or undone.
- * Virtual base class for actions with a name.
- * An action object inherits the shared object reference count mechanism.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-class ACT_Action : public MEM_RefCounted {
-public:
- /**
- * Constructs an action with the given name .
- * @param name the name of the action.
- * @param applied state of the action after creation.
- */
- ACT_Action(const STR_String& name, bool applied = false);
-
- /**
- * Returns the name of the action.
- * @param name the name of the action.
- */
- inline virtual void getName(STR_String& name) const;
-
- /**
- * Returns the name of the action as a pointer to the data of the string.
- * @return pointer to the name of the action.
- */
- inline virtual char* getName();
-
- /**
- * Sets the name of the action.
- * @param name the name of the action.
- */
- inline virtual void setName(const STR_String& name);
-
- /**
- * Returns whether this action is applied.
- * @return whether this action is applied.
- */
- inline virtual bool getIsApplied() const;
-
-
- /**
- * Call this member to apply an action.
- * Child classes should override the doApply member to implement apply functionality.
- * @see doApply.
- */
- virtual void apply();
-
- /**
- * Call this member to undo an action .
- * Child classes should override the doUndo member to implement undo functionality.
- * @see doApply()
- */
- virtual void undo();
-
-protected:
- /**
- * Implementations should overload this method to provide the apply functionality.
- */
- virtual void doApply() = 0;
-
- /**
- * Implementations should overload this method to provide the undo functionality.
- */
- virtual void doUndo() = 0;
-
- /** Name of this action */
- STR_String m_name;
- /** Is this action already applied? */
- bool m_applied;
-};
-
-
-void ACT_Action::getName(STR_String& name) const
-{
- name = m_name;
-}
-
-char* ACT_Action::getName()
-{
- return m_name.Ptr();
-}
-
-void ACT_Action::setName(const STR_String& name)
-{
- m_name = name;
-}
-
-inline bool ACT_Action::getIsApplied() const
-{
- return m_applied;
-}
-
-#endif // _H_ACT_ACTION_H_
-
diff --git a/intern/action/ACT_ActionC-Api.h b/intern/action/ACT_ActionC-Api.h
deleted file mode 100644
index 64f279a2df6..00000000000
--- a/intern/action/ACT_ActionC-Api.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Interface for C access to actions.
- * @author Maarten Gribnau
- * @date April, 25, 2001
- */
-
-#ifndef _H_ACT_ACTION_C_API
-#define _H_ACT_ACTION_C_API
-
-#include "MEM_RefCountedC-Api.h"
-
-/** A pointer to an action object. */
-typedef MEM_TRefCountedObjectPtr ACT_ActionPtr;
-/** A pointer to an action stack object. */
-typedef MEM_TObjectPtr ACT_ActionStackPtr;
-
-
-/** A pointer to user data passed by the callbacks. */
-typedef void* ACT_ActionUserDataPtr;
-
-/**
- * An action apply callback routine.
- * @param action The action that should be applied.
- * @param userData The pointer to the user data provided when the action was created.
- */
-typedef void (*ACT_ActionApplyProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-
-/**
- * An action undo callback routine.
- * @param action The action that should be undone.
- * @param userData The pointer to the user data provided when the action was created.
- */
-typedef void (*ACT_ActionUndoProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-
-/**
- * An action dispose callback routine.
- * @param action The action that is disposed.
- * @param userData The pointer to the user data provided when the action was created.
- */
-typedef void (*ACT_ActionDisposeProcPtr)(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * An action is a shared object that can be applied or undone.
- */
-
-/**
- * Creates a new action.
- * This is an action that calls the given callbacks when it needs to be applied or undone.
- * @param name The name of the action.
- * @param isApplied Indication as to whether the action is already applied (0 = not applied).
- * @param userData Pointer passed to the apply/undo callbacks.
- * @param applyProc Pointer to the callback invoked when the action needs to be applied.
- * @param undoProc Pointer to the callback invoked when the action needs to be undone.
- * @return The new action (null in case of error).
- */
-extern ACT_ActionPtr ACT_ActionCreate(
- char* name,
- int isApplied,
- ACT_ActionUserDataPtr userData,
- ACT_ActionApplyProcPtr applyProc,
- ACT_ActionUndoProcPtr undoProc,
- ACT_ActionDisposeProcPtr disposeProc);
-
-/**
- * Returns the name of an action.
- * @return The name of the action (null in case of error).
- */
-extern char* ACT_ActionGetName(ACT_ActionPtr action);
-
-
-
-/**
- * An action stack stores actions and implements undo/redo functionality.
- */
-
-/**
- * Creates a new action stack.
- * @param stackSize The maximum number of actions on the stack.
- * @return The new stack (or NULL in case of error).
- */
-extern ACT_ActionStackPtr ACT_ActionStackCreate(unsigned int stackSize);
-
-/**
- * Disposes an action stack.
- * @param stack The appropriate stack.
- */
-extern void ACT_ActionStackDispose(ACT_ActionStackPtr stack);
-
-/**
- * Returns the current depth of the stack.
- * @param stack The appropriate stack.
- * @return the current stack depth.
- */
-extern unsigned int ACT_ActionStackGetStackDepth(ACT_ActionStackPtr stack);
-
-/**
- * Returns the current maximum depth of the stack.
- * @param stack The appropriate stack.
- * @return the maximum stack depth.
- */
-extern unsigned int ACT_ActionStackGetMaxStackDepth(ACT_ActionStackPtr stack);
-
-/**
- * Sets new maximum depth of the stack.
- * @param stack The appropriate stack.
- * @param maxStackDepth The new stack depth.
- */
-extern void ACT_ActionStackSetMaxStackDepth(ACT_ActionStackPtr stack, unsigned int maxStackDepth);
-
-/**
- * Pushes an action on the stack.
- * If the action has not been applied yet, it will be applied here.
- * This will increase the reference count of the action.
- * If there is not enough capacity, the action at the bottom of the stack is removed (and its reference count decreased).
- * @param stack The appropriate stack.
- * @param action the action that is pushed onto the stack.
- */
-extern void ACT_ActionStackPush(ACT_ActionStackPtr stack, ACT_ActionPtr action);
-
-/**
- * Returns pointer to the current undo item.
- * @param stack The appropriate stack.
- * @return The action scheduled for undo (0 if there is none).
- */
-extern ACT_ActionStackPtr ACT_ActionStackPeekUndo(ACT_ActionStackPtr stack);
-
-/**
- * Returns pointer to the current redo item.
- * @param stack The appropriate stack.
- * @return The action scheduled for redo (0 if there is none).
- */
-extern ACT_ActionStackPtr ACT_ActionStackPeekRedo(ACT_ActionStackPtr stack);
-
-/**
- * Undos the current action.
- * @param stack The appropriate stack.
- * This will move the current undo index down (if the stack depth allows it).
- */
-extern void ACT_ActionStackUndo(ACT_ActionStackPtr stack);
-
-/**
- * Redos the current action.
- * @param stack The appropriate stack.
- * This will move the action index up (if the stack depth allows it).
- */
-extern void ACT_ActionStackRedo(ACT_ActionStackPtr stack);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _H_ACT_ACTION_C_API
-
diff --git a/intern/action/ACT_ActionStack.h b/intern/action/ACT_ActionStack.h
deleted file mode 100644
index 421dca76e59..00000000000
--- a/intern/action/ACT_ActionStack.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifndef _H_ACT_ACTIONSTACK
-#define _H_ACT_ACTIONSTACK
-
-#include "ACT_Action.h"
-#include <deque>
-
-
-/**
- * A stack with actions that implements undo/redo capabilities.
- * A stack can grow to a maximum number of actions by pushing actions on the stack.
- * By calling undo and redo the apply and undo members of the actions on the stack are called.
- * In addition, this will move the stackIndex up and down the stack.
- * When a new action is pushed onto the stack, the actions above the current action are removed from the stack.
- * Actions pushed onto the stack are applied if they are not applied already.
- * @todo implement error handling (e.g. memory errors)
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-class ACT_ActionStack {
-public:
- /**
- * Constructs an action stack.
- */
- ACT_ActionStack(unsigned int maxStackDepth = 1);
-
- /**
- * Destructs an action stack.
- */
- virtual ~ACT_ActionStack();
-
- /**
- * Returns the current depth of the stack.
- * @return the current stack depth.
- */
- virtual unsigned int getStackDepth() const;
-
- /**
- * Returns the current maximum depth of the stack.
- * @return the maximum stack depth.
- */
- virtual unsigned int getMaxStackDepth() const;
-
- /**
- * Sets new maximum depth of the stack.
- * @param maxStackDepth The new stack depth.
- */
- virtual void setMaxStackDepth(unsigned int maxStackDepth);
-
- /**
- * Pushes an action on the stack.
- * If the action has not been applied yet, it will be applied here.
- * This will increase the reference count of the action.
- * If there is not enough capacity, the action at the bottom of the stack is removed (and its reference count decreased).
- * @param action the action that is pushed onto the stack.
- */
- virtual void push(ACT_Action& action);
-
- /**
- * Returns pointer to the current undo item.
- * @return The action scheduled for undo (0 if there is none).
- */
- virtual ACT_Action* peekUndo();
-
- /**
- * Returns pointer to the current redo item.
- * @return The action scheduled for redo (0 if there is none).
- */
- virtual ACT_Action* peekRedo();
-
- /**
- * Flushes the action stack.
- * All actions are removed from the stack and their reference counts decreased.
- */
- virtual void flush();
-
- /**
- * Returns whether we can undo the current action.
- * @return Indication of the possibility to undo.
- */
- virtual bool canUndo() const;
-
- /**
- * Undos the current action.
- * This will move the current undo index down (if the stack depth allows it).
- */
- virtual void undo();
-
- /**
- * Returns whether we can redo the current action.
- * @return Indication of the possibility to redo.
- */
- virtual bool canRedo() const;
-
- /**
- * Redos the current action.
- * This will move the action index up (if the stack depth allows it).
- */
- virtual void redo();
-
-protected:
- /**
- * Removes <i>numActions</i> actions from the back of the stack.
- * @param numActions number of items to remove.
- * @return the number of actions removed.
- */
- virtual unsigned int popBack(unsigned int numActions = 1);
-
- /**
- * Removes <i>numActions</i> actions from the front of the stack.
- * @param numActions number of items to remove.
- * @return the number of actions removed.
- */
- virtual unsigned int popFront(unsigned int numActions = 1);
-
- /**
- * Returns the index of the current undo action.
- * @param index The index of the action.
- * @return Indication as to whether the index is valid (==true).
- */
- virtual bool getUndoIndex(unsigned int& index) const;
-
- /**
- * Returns the index of the current redo action.
- * @param index The index of the action.
- * @return Indication as to whether the index is valid (==true).
- */
- virtual bool getRedoIndex(unsigned int& index) const;
-
- /** The maximum depth of this stack. */
- unsigned int m_maxStackDepth;
- /** The index of the current undo action in the stack. */
- unsigned int m_undoIndex;
- /** Is the index of the current undo action in the stack valid? */
- bool m_undoIndexValid;
- /** The index of the current redo action in the stack. */
- unsigned int m_redoIndex;
- /** Is the index of the current redo action in the stack valid? */
- bool m_redoIndexValid;
- /** The stack with actions. */
- deque<ACT_Action*> m_stack;
-};
-
-
-#endif // _H_ACT_ACTIONSTACK
-
diff --git a/intern/action/Makefile b/intern/action/Makefile
deleted file mode 100644
index ed1cfccfc52..00000000000
--- a/intern/action/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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): Hans Lambermont
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-# action main makefile.
-#
-
-include nan_definitions.mk
-
-LIBNAME = action
-SOURCEDIR = intern/$(LIBNAME)
-DIR = $(OCGDIR)/$(SOURCEDIR)
-DIRS = intern
-TESTDIRS = test
-
-include nan_subdirs.mk
-
-install: all debug
- @[ -d $(NAN_ACTION) ] || mkdir $(NAN_ACTION)
- @[ -d $(NAN_ACTION)/include ] || mkdir $(NAN_ACTION)/include
- @[ -d $(NAN_ACTION)/lib ] || mkdir $(NAN_ACTION)/lib
- @[ -d $(NAN_ACTION)/lib/debug ] || mkdir $(NAN_ACTION)/lib/debug
- @../tools/cpifdiff.sh $(DIR)/libaction.a $(NAN_ACTION)/lib/
- @../tools/cpifdiff.sh $(DIR)/debug/libaction.a $(NAN_ACTION)/lib/debug/
- @../tools/cpifdiff.sh *.h $(NAN_ACTION)/include/
-
diff --git a/intern/action/doc/Doxyfile b/intern/action/doc/Doxyfile
deleted file mode 100644
index 2cc9de2d97c..00000000000
--- a/intern/action/doc/Doxyfile
+++ /dev/null
@@ -1,746 +0,0 @@
-# Doxyfile 1.2.4
-
-# This file describes the settings to be used by doxygen for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-PROJECT_NAME = foundation
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese,
-# Korean, Hungarian, Norwegian, Spanish, Romanian, Russian, Croatian,
-# Polish, Portuguese and Slovene.
-
-OUTPUT_LANGUAGE = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these class will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
-STRIP_FROM_PATH =
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a class diagram (in Html and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off.
-
-CLASS_DIAGRAMS = YES
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower case letters. If set to YES upper case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are adviced to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
-INHERIT_DOCS = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# The ENABLE_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ../extern ../intern
-
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-FILE_PATTERNS = *.h *.cpp *.c
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
-INPUT_FILTER =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse.
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side pannel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Netscape 4.0+
-# or Internet explorer 4.0+).
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using a WORD or other.
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Warning: This feature
-# is still experimental and very incomplete.
-
-GENERATE_XML = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH = ../../generic/extern
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tagfiles.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to
-# YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other
-# documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to
-# YES then doxygen will generate a graph for each documented header file showing
-# the documented files that directly or indirectly include this file
-
-INCLUDED_BY_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
-CGI_NAME = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
-CGI_URL =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
-DOC_URL =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
-DOC_ABSPATH =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
-BIN_ABSPATH = c:\program files\doxygen\bin
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
-EXT_DOC_PATHS =
diff --git a/intern/action/intern/ACT_Action.cpp b/intern/action/intern/ACT_Action.cpp
deleted file mode 100644
index a94c3c9f336..00000000000
--- a/intern/action/intern/ACT_Action.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date April, 25, 2001
- */
-
-#include "ACT_Action.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-ACT_Action::ACT_Action(const STR_String& name, bool applied)
-: m_name(name), m_applied(applied)
-{
-}
-
-
-void ACT_Action::apply()
-{
- if (!m_applied) {
- doApply();
- m_applied = true;
- }
-}
-
-
-void ACT_Action::undo()
-{
- if (m_applied) {
- doUndo();
- m_applied = false;
- }
-}
diff --git a/intern/action/intern/ACT_ActionC-Api.cpp b/intern/action/intern/ACT_ActionC-Api.cpp
deleted file mode 100644
index 7fcd1d7b60a..00000000000
--- a/intern/action/intern/ACT_ActionC-Api.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date April, 25, 2001
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ACT_ActionC-Api.h"
-
-#include "ACT_ActionStack.h"
-#include "ACT_CallbackAction.h"
-
-
-ACT_ActionPtr ACT_ActionCreate(
- char* name,
- int isApplied,
- ACT_ActionUserDataPtr data,
- ACT_ActionApplyProcPtr applyProc,
- ACT_ActionUndoProcPtr undoProc,
- ACT_ActionDisposeProcPtr disposeProc)
-{
- STR_String tmp (name);
- ACT_CallbackAction* action = new ACT_CallbackAction(tmp, isApplied != 0, data, applyProc, undoProc, disposeProc);
- return (ACT_ActionPtr) action;
-}
-
-
-char* ACT_ActionGetName(ACT_ActionPtr action)
-{
- return action ? ((ACT_Action*)action)->getName() : 0;
-}
-
-
-ACT_ActionStackPtr ACT_ActionStackCreate(unsigned int stackSize)
-{
- return ((ACT_ActionStackPtr) (new ACT_ActionStack (stackSize)));
-}
-
-
-void ACT_ActionStackDispose(ACT_ActionStackPtr stack)
-{
- if (stack) {
- delete (ACT_ActionStack*) stack;
- }
-}
-
-
-unsigned int ACT_ActionStackGetStackDepth(ACT_ActionStackPtr stack)
-{
- return stack ? ((ACT_ActionStack*)stack)->getStackDepth() : 0;
-}
-
-unsigned int ACT_ActionStackGetMaxStackDepth(ACT_ActionStackPtr stack)
-{
- return stack ? ((ACT_ActionStack*)stack)->getMaxStackDepth() : 0;
-}
-
-void ACT_ActionStackSetMaxStackDepth(ACT_ActionStackPtr stack, unsigned int maxStackDepth)
-{
- if (stack) {
- ((ACT_ActionStack*)stack)->setMaxStackDepth(maxStackDepth);
- }
-}
-
-void ACT_ActionStackPush(ACT_ActionStackPtr stack, ACT_ActionPtr action)
-{
- if (stack && action) {
- ((ACT_ActionStack*)stack)->push(*((ACT_Action*)action));
- }
-}
-
-
-ACT_ActionStackPtr ACT_ActionStackPeekUndo(ACT_ActionStackPtr stack)
-{
- return (ACT_ActionStackPtr) (stack ? ((ACT_ActionStack*)stack)->peekUndo() : 0);
-}
-
-
-ACT_ActionStackPtr ACT_ActionStackPeekRedo(ACT_ActionStackPtr stack)
-{
- return (ACT_ActionStackPtr) (stack ? ((ACT_ActionStack*)stack)->peekRedo() : 0);
-}
-
-
-void ACT_ActionStackUndo(ACT_ActionStackPtr stack)
-{
- if (stack) {
- ((ACT_ActionStack*)stack)->undo();
- }
-}
-
-
-void ACT_ActionStackRedo(ACT_ActionStackPtr stack)
-{
- if (stack) {
- ((ACT_ActionStack*)stack)->redo();
- }
-}
diff --git a/intern/action/intern/ACT_ActionStack.cpp b/intern/action/intern/ACT_ActionStack.cpp
deleted file mode 100644
index 2025f744958..00000000000
--- a/intern/action/intern/ACT_ActionStack.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ACT_ActionStack.h"
-
-
-ACT_ActionStack::ACT_ActionStack(unsigned int maxStackDepth)
- : m_maxStackDepth(maxStackDepth),
- m_undoIndex(0), m_undoIndexValid(false),
- m_redoIndex(0), m_redoIndexValid(false)
-{
-}
-
-
-ACT_ActionStack::~ACT_ActionStack()
-{
- flush();
-}
-
-
-unsigned int ACT_ActionStack::getStackDepth() const
-{
- return m_stack.size();
-}
-
-
-unsigned int ACT_ActionStack::getMaxStackDepth() const
-{
- return m_maxStackDepth;
-}
-
-
-void ACT_ActionStack::setMaxStackDepth(unsigned int maxStackDepth)
-{
- if (maxStackDepth != m_maxStackDepth) {
- if (maxStackDepth) {
- unsigned int size = m_stack.size();
- if (maxStackDepth < size) {
- // New max stack size is smaller than current stack size, need to shrink stack
- unsigned int numRemove = size - maxStackDepth;
- if (m_undoIndex >= maxStackDepth) {
- // Pop items from the front (throw away undo steps)
- popFront(numRemove);
- m_undoIndex -= numRemove;
- m_redoIndex = m_undoIndex + 1;
- m_redoIndexValid = m_redoIndexValid && (maxStackDepth > 1);
- }
- else {
- // Pop items from the back (throw away redo steps)
- popBack(numRemove);
- m_redoIndexValid = m_redoIndexValid && (m_redoIndex < maxStackDepth);
- }
- }
- }
- else {
- // New stack size is zero
- flush();
- }
- m_maxStackDepth = maxStackDepth;
- }
-}
-
-
-void ACT_ActionStack::push(ACT_Action& action)
-{
- if (m_maxStackDepth) {
- unsigned int size = m_stack.size();
- if (m_redoIndexValid) {
- // Remove items after the current action (throw away redo steps)
- popBack(size - m_redoIndex);
- }
- else if (size >= m_maxStackDepth) {
- // Remove items from the front (throw away undo steps)
- popFront(m_maxStackDepth - size + 1);
- }
-
- // Store the action
- if (!action.getIsApplied()) {
- action.apply();
- }
- action.incRef();
- m_stack.push_back(&action);
-
- // Update action indices
- m_redoIndex = m_stack.size();
- m_redoIndexValid = false;
- m_undoIndex = m_redoIndex - 1;
- m_undoIndexValid = true;
- }
-}
-
-
-ACT_Action* ACT_ActionStack::peekUndo()
-{
- unsigned int i;
- return getUndoIndex(i) ? m_stack[i] : 0;
-}
-
-
-ACT_Action* ACT_ActionStack::peekRedo()
-{
- unsigned int i;
- return getRedoIndex(i) ? m_stack[i] : 0;
-}
-
-
-void ACT_ActionStack::flush()
-{
- popBack(m_stack.size());
- m_undoIndex = 0;
- m_undoIndexValid = false;
- m_redoIndex = 0;
- m_redoIndexValid = false;
-}
-
-
-bool ACT_ActionStack::canUndo() const
-{
- unsigned int i;
- return getUndoIndex(i);
-}
-
-
-void ACT_ActionStack::undo()
-{
- ACT_Action* action = peekUndo();
- if (action) {
- action->undo();
-
- // Update action indices
- m_redoIndex = m_undoIndex;
- m_redoIndexValid = true;
- if (m_undoIndex) {
- m_undoIndex--;
- }
- else {
- m_undoIndexValid = false;
- }
- }
-}
-
-
-bool ACT_ActionStack::canRedo() const
-{
- unsigned int i;
- return getRedoIndex(i);
-}
-
-
-void ACT_ActionStack::redo()
-{
- ACT_Action* action = peekRedo();
- if (action) {
- action->apply();
-
- // Update action indices
- m_undoIndex = m_redoIndex;
- m_undoIndexValid = true;
- m_redoIndex++;
- m_redoIndexValid = m_redoIndex < m_stack.size();
- }
-}
-
-
-unsigned int ACT_ActionStack::popFront(unsigned int numActions)
-{
- unsigned int numRemoved = 0;
-
- while (numActions-- && m_stack.size()) {
- ACT_Action* action = m_stack[0];
- action->decRef();
- m_stack.pop_front();
- numRemoved++;
- }
- return numRemoved;
-}
-
-
-unsigned int ACT_ActionStack::popBack(unsigned int numActions)
-{
- unsigned int numRemoved = 0;
- unsigned int size;
-
- while (numActions-- && (size = m_stack.size())) {
- ACT_Action* action = m_stack[size-1];
- action->decRef();
- m_stack.pop_back();
- numRemoved++;
- }
- return numRemoved;
-}
-
-
-bool ACT_ActionStack::getUndoIndex(unsigned int& i) const
-{
- i = m_undoIndex;
- return m_undoIndexValid;
-}
-
-
-bool ACT_ActionStack::getRedoIndex(unsigned int& i) const
-{
- i = m_redoIndex;
- return m_redoIndexValid;
-}
diff --git a/intern/action/intern/ACT_CallbackAction.h b/intern/action/intern/ACT_CallbackAction.h
deleted file mode 100644
index 148a77f13ed..00000000000
--- a/intern/action/intern/ACT_CallbackAction.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date June 17, 2001
- */
-
-#ifndef _H_ACT_CALLBACK_ACTION_H
-#define _H_ACT_CALLBACK_ACTION_H
-
-#include "ACT_Action.h"
-#include "ACT_ActionC-Api.h"
-
-
-/**
- * An action implementation that uses callbacks for undo and redo.
- * @author Maarten Gribnau
- * @date June 17, 2001
- */
-
-class ACT_CallbackAction : public ACT_Action {
-public:
- /**
- * Constructs an action with the given name .
- * @param name The name of the action.
- * @param applied State of the action after creation.
- * @param data Pointer to user data passed to the callbacks.
- * @param applyProc Callback invoked for apply action.
- * @param undoProc Callback invoked for undo action.
- */
- ACT_CallbackAction(
- STR_String& name,
- bool applied,
- ACT_ActionUserDataPtr data,
- ACT_ActionApplyProcPtr applyProc,
- ACT_ActionUndoProcPtr undoProc,
- ACT_ActionDisposeProcPtr disposeProc)
- : ACT_Action(name, applied), m_userData(data), m_applyProc(applyProc), m_undoProc(undoProc), m_disposeProc(disposeProc)
- {
- }
-
- /**
- * Default destructor.
- * Will call the dispose callback.
- */
- virtual ~ACT_CallbackAction()
- {
- // Should assert
- m_disposeProc((ACT_ActionPtr)this, m_userData);
- }
-
-
-protected:
- /**
- * Calls the appropriate callback.
- */
- inline virtual void doApply();
-
- /**
- * Calls the appropriate callback.
- */
- inline virtual void doUndo();
-
- /** User data supplied at creation and passed to the callbacks. */
- ACT_ActionUserDataPtr m_userData;
-
- /** Callback invoked for apply action. */
- ACT_ActionApplyProcPtr m_applyProc;
-
- /** Callback invoked for undo action. */
- ACT_ActionApplyProcPtr m_undoProc;
-
- /** Callback invoked when the action is disposed. */
- ACT_ActionDisposeProcPtr m_disposeProc;
-};
-
-
-inline void ACT_CallbackAction::doApply()
-{
- // Should assert
- m_applyProc((ACT_ActionPtr)this, m_userData);
-}
-
-
-inline void ACT_CallbackAction::doUndo()
-{
- // Should assert
- m_undoProc((ACT_ActionPtr)this, m_userData);
-}
-
-
-#endif // _H_ACT_CALLBACK_ACTION_H
-
diff --git a/intern/action/intern/Makefile b/intern/action/intern/Makefile
deleted file mode 100644
index 29f82bb7c0d..00000000000
--- a/intern/action/intern/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
-# action intern Makefile
-#
-
-LIBNAME = action
-DIR = $(OCGDIR)/intern/$(LIBNAME)
-
-include nan_compile.mk
-
-CPPFLAGS += -I..
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MEMUTIL)/include
-
diff --git a/intern/action/make/msvc_6_0/action.dsp b/intern/action/make/msvc_6_0/action.dsp
deleted file mode 100644
index 3ea450b19a7..00000000000
--- a/intern/action/make/msvc_6_0/action.dsp
+++ /dev/null
@@ -1,128 +0,0 @@
-# Microsoft Developer Studio Project File - Name="action" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=action - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "action.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "action.mak" CFG="action - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "action - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "action - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "action - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../../../../../obj/windows/intern/action/"
-# PROP Intermediate_Dir "../../../../../obj/windows/intern/action/"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../.." /I "../../../../lib/windows/memutil/include/" /I "../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "action - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../../../../../obj/windows/intern/action/debug"
-# PROP Intermediate_Dir "../../../../../obj/windows/intern/action/debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../.." /I "../../../../lib/windows/memutil/include/" /I "../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "action - Win32 Release"
-# Name "action - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\intern\ACT_Action.cpp
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\intern\ACT_ActionC-Api.cpp"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\ACT_ActionStack.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Group "intern"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\intern\ACT_CallbackAction.h
-# End Source File
-# End Group
-# Begin Group "extern"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\ACT_Action.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\ACT_ActionC-Api.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ACT_ActionStack.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/intern/action/make/msvc_6_0/action.dsw b/intern/action/make/msvc_6_0/action.dsw
deleted file mode 100644
index f93cbb896fd..00000000000
--- a/intern/action/make/msvc_6_0/action.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "action"=".\action.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/intern/action/make/msvc_7_0/action.sln b/intern/action/make/msvc_7_0/action.sln
deleted file mode 100644
index 3ab830940c8..00000000000
--- a/intern/action/make/msvc_7_0/action.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "action", "action.vcproj", "{FA745D82-2D98-4843-8B72-874AB3622A8C}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {FA745D82-2D98-4843-8B72-874AB3622A8C}.Debug.ActiveCfg = Debug|Win32
- {FA745D82-2D98-4843-8B72-874AB3622A8C}.Debug.Build.0 = Debug|Win32
- {FA745D82-2D98-4843-8B72-874AB3622A8C}.Release.ActiveCfg = Release|Win32
- {FA745D82-2D98-4843-8B72-874AB3622A8C}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/intern/action/make/msvc_7_0/action.vcproj b/intern/action/make/msvc_7_0/action.vcproj
deleted file mode 100644
index 04af58a8d52..00000000000
--- a/intern/action/make/msvc_7_0/action.vcproj
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="action"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\../../../../../obj/windows/intern/action/debug"
- IntermediateDirectory=".\../../../../../obj/windows/intern/action/debug"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../..,../../../../lib/windows/memutil/include/,../../../../lib/windows/string/include/"
- PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\../../../../../obj/windows/intern/action/debug/action.pch"
- AssemblerListingLocation=".\../../../../../obj/windows/intern/action/debug/"
- ObjectFile=".\../../../../../obj/windows/intern/action/debug/"
- ProgramDataBaseFileName=".\../../../../../obj/windows/intern/action/debug/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile=".\../../../../../obj/windows/intern/action/debug\action.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\../../../../../obj/windows/intern/action"
- IntermediateDirectory=".\../../../../../obj/windows/intern/action"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="../..,../../../../lib/windows/memutil/include/,../../../../lib/windows/string/include/"
- PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\../../../../../obj/windows/intern/action/action.pch"
- AssemblerListingLocation=".\../../../../../obj/windows/intern/action/"
- ObjectFile=".\../../../../../obj/windows/intern/action/"
- ProgramDataBaseFileName=".\../../../../../obj/windows/intern/action/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile=".\../../../../../obj/windows/intern/action\action.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
- <File
- RelativePath="..\..\intern\ACT_Action.cpp">
- </File>
- <File
- RelativePath="..\..\intern\ACT_ActionC-Api.cpp">
- </File>
- <File
- RelativePath="..\..\intern\ACT_ActionStack.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl">
- <Filter
- Name="intern"
- Filter="">
- <File
- RelativePath="..\..\intern\ACT_CallbackAction.h">
- </File>
- </Filter>
- <Filter
- Name="extern"
- Filter="">
- <File
- RelativePath="..\..\ACT_Action.h">
- </File>
- <File
- RelativePath="..\..\ACT_ActionC-Api.h">
- </File>
- <File
- RelativePath="..\..\ACT_ActionStack.h">
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/intern/action/test/action_c_test/ActionTest.c b/intern/action/test/action_c_test/ActionTest.c
deleted file mode 100644
index 8f169528204..00000000000
--- a/intern/action/test/action_c_test/ActionTest.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ACT_ActionC-Api.h"
-#include "TestAction.h"
-
-int main(int argc, char *argv[])
-{
- ACT_ActionStackPtr stack = ACT_ActionStackCreate (3);
- ACT_ActionPtr action = ACT_ActionCreate("action1", 0, 0, printApplied, printUndone, printDisposed);
- ACT_ActionStackPush(stack, action);
- MEM_RefCountedDecRef(action);
- action = ACT_ActionCreate("action2", 0, 0, printApplied, printUndone, printDisposed);
- ACT_ActionStackPush(stack, action);
- MEM_RefCountedDecRef(action);
- action = ACT_ActionCreate("action3", 0, 0, printApplied, printUndone, printDisposed);
- ACT_ActionStackPush(stack, action);
- MEM_RefCountedDecRef(action);
-
- ACT_ActionStackUndo(stack);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackRedo(stack);
- ACT_ActionStackRedo(stack);
- ACT_ActionStackRedo(stack);
-
- ACT_ActionStackSetMaxStackDepth(stack, 1);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackRedo(stack);
- ACT_ActionStackSetMaxStackDepth(stack, 5);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackRedo(stack);
-
- action = ACT_ActionCreate("action4", 0, 0, printApplied, printUndone, printDisposed);
- ACT_ActionStackPush(stack, action);
- MEM_RefCountedDecRef(action);
- ACT_ActionStackUndo(stack);
- action = ACT_ActionCreate("action5", 0, 0, printApplied, printUndone, printDisposed);
- ACT_ActionStackPush(stack, action);
- MEM_RefCountedDecRef(action);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackUndo(stack);
- ACT_ActionStackRedo(stack);
- ACT_ActionStackRedo(stack);
-
- return 0;
-}
diff --git a/intern/action/test/action_c_test/TestAction.c b/intern/action/test/action_c_test/TestAction.c
deleted file mode 100644
index 0b4896dadd7..00000000000
--- a/intern/action/test/action_c_test/TestAction.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "TestAction.h"
-
-
-void printApplied(ACT_ActionPtr action, ACT_ActionUserDataPtr userData)
-{
- printf("%s: applied\n", ACT_ActionGetName(action));
-}
-
-void printUndone(ACT_ActionPtr action, ACT_ActionUserDataPtr userData)
-{
- printf("%s: undone\n", ACT_ActionGetName(action));
-}
-
-
-void printDisposed(ACT_ActionPtr action, ACT_ActionUserDataPtr userData)
-{
- printf("%s: disposed\n", ACT_ActionGetName(action));
-}
diff --git a/intern/action/test/action_c_test/TestAction.h b/intern/action/test/action_c_test/TestAction.h
deleted file mode 100644
index 487d8777b81..00000000000
--- a/intern/action/test/action_c_test/TestAction.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifndef _H_ACT_TESTACTION_C_H_
-#define _H_ACT_TESTACTION_C_H_
-
-#include "ACT_ActionC-Api.h"
-
-void printApplied(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-void printUndone(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-void printDisposed(ACT_ActionPtr action, ACT_ActionUserDataPtr userData);
-
-
-#endif // _H_ACT_TESTACTION_C_H_
-
diff --git a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp
deleted file mode 100644
index 807024f20be..00000000000
--- a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="action_c_test" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=action_c_test - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "action_c_test.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "action_c_test.mak" CFG="action_c_test - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "action_c_test - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "action_c_test - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "action_c_test - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test"
-# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../../../../lib/windows/memutil/lib" /libpath:"../../../../../../lib/windows/string/lib"
-
-!ELSEIF "$(CFG)" == "action_c_test - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test/debug"
-# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test/debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../../../../lib/windows/memutil/lib/debug" /libpath:"../../../../../../lib/windows/string/lib/debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "action_c_test - Win32 Release"
-# Name "action_c_test - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ActionTest.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\TestAction.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\TestAction.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw b/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw
deleted file mode 100644
index 688f24e4d53..00000000000
--- a/intern/action/test/action_c_test/make/msvc_6_0/action_c_test.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "action"="..\..\..\..\make\msvc_6_0\action.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "action_c_test"=".\action_c_test.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name action
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/intern/action/test/action_cpp_test/ActionTest.cpp b/intern/action/test/action_cpp_test/ActionTest.cpp
deleted file mode 100644
index 55173bafb7b..00000000000
--- a/intern/action/test/action_cpp_test/ActionTest.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ACT_ActionStack.h"
-#include "TestAction.h"
-
-int main()
-{
- ACT_ActionStack testStack (3);
- TestAction* testAction = new TestAction (STR_String("action1"));
- testStack.push(*testAction);
- testAction->decRef();
- testAction = new TestAction (STR_String("action2"));
- testStack.push(*testAction);
- testAction->decRef();
- testAction = new TestAction (STR_String("action3"));
- testStack.push(*testAction);
- testAction->decRef();
-
- testStack.undo();
- testStack.undo();
- testStack.undo();
- testStack.redo();
- testStack.redo();
- testStack.redo();
-
- testStack.setMaxStackDepth(1);
- testStack.undo();
- testStack.redo();
- testStack.setMaxStackDepth(5);
- testStack.undo();
- testStack.redo();
-
- testAction = new TestAction (STR_String("action4"));
- testStack.push(*testAction);
- testAction->decRef();
- testStack.undo();
- testAction = new TestAction (STR_String("action5"));
- testStack.push(*testAction);
- testAction->decRef();
- testStack.undo();
- testStack.undo();
- testStack.redo();
- testStack.redo();
-
- return 0;
-}
diff --git a/intern/action/test/action_cpp_test/TestAction.h b/intern/action/test/action_cpp_test/TestAction.h
deleted file mode 100644
index 3cd5ed893ad..00000000000
--- a/intern/action/test/action_cpp_test/TestAction.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date March 31, 2001
- */
-
-#ifndef _H_ACT_TESTACTION
-#define _H_ACT_TESTACTION
-
-#include "ACT_Action.h"
-
-#include <iostream>
-
-class TestAction : public ACT_Action
-{
-public:
- TestAction(const STR_String& name) : ACT_Action(name) {}
- virtual ~TestAction() { cout << m_name.Ptr() << ": deleted\n"; }
-protected:
- virtual void doApply() { cout << m_name.Ptr() << ": applied\n"; }
- virtual void doUndo() { cout << m_name.Ptr() << ": undone\n"; }
-};
-
-#endif // _H_ACT_TESTACTION
-
diff --git a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp
deleted file mode 100644
index bc0c40b6d36..00000000000
--- a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsp
+++ /dev/null
@@ -1,105 +0,0 @@
-# Microsoft Developer Studio Project File - Name="action_cpp_test" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=action_cpp_test - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "action_cpp_test.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "action_cpp_test.mak" CFG="action_cpp_test - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "action_cpp_test - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "action_cpp_test - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "action_cpp_test - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test"
-# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../../../../lib/windows/memutil/lib" /libpath:"../../../../../../lib/windows/string/lib"
-
-!ELSEIF "$(CFG)" == "action_cpp_test - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../../../../../../../obj/windows/intern/action/test/debug"
-# PROP Intermediate_Dir "../../../../../../../obj/windows/intern/action/test/debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../.." /I "../../../../../../lib/windows/memutil/include/" /I "../../../../../../lib/windows/string/include/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib string.lib memutil.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../../../../lib/windows/memutil/lib/debug" /libpath:"../../../../../../lib/windows/string/lib/debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "action_cpp_test - Win32 Release"
-# Name "action_cpp_test - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ActionTest.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\TestAction.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw b/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw
deleted file mode 100644
index 0a9d7374379..00000000000
--- a/intern/action/test/action_cpp_test/make/msvc_6_0/action_cpp_test.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "action"="..\..\..\..\make\msvc_6_0\action.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "action_cpp_test"=".\action_cpp_test.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name action
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/intern/bmfont/BMF_Api.h b/intern/bmfont/BMF_Api.h
index 001a9788920..4465242e9fa 100644
--- a/intern/bmfont/BMF_Api.h
+++ b/intern/bmfont/BMF_Api.h
@@ -89,13 +89,30 @@ int BMF_GetCharacterWidth(BMF_Font* font, char c);
int BMF_GetStringWidth(BMF_Font* font, char* str);
/**
+ * Returns the bounding box of a string of characters.
+ * @param font The font to use.
+ * @param str The string.
+ * @param llx Lower left x coord
+ * @param lly Lower left y coord
+ * @param urx Upper right x coord
+ * @param ury Upper right y coord
+ */
+void BMF_GetStringBoundingBox(BMF_Font* font, char* str, float*llx, float *lly, float *urx, float *ury);
+
+
+/**
* Returns the bounding box of the font. The width and
* height represent the bounding box of the union of
* all glyps. The minimum and maximum values of the
* box represent the extent of the font and its positioning
* about the origin.
*/
-void BMF_GetBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r);
+void BMF_GetFontBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r);
+
+/**
+ * Same as GetFontBoundingBox but only returns the height
+ */
+int BMF_GetFontHeight(BMF_Font* font);
/**
* Convert the given @a font to a texture, and return the GL texture
@@ -122,6 +139,24 @@ int BMF_GetFontTexture(BMF_Font* font);
*/
void BMF_DrawStringTexture(BMF_Font* font, char* string, float x, float y, float z);
+ /**
+ * Draw the given @a string at the point @a xpos, @a ypos using
+ * char and float buffers.
+ *
+ * @param string The c-string to draw.
+ * @param xpos The x coordinate to start drawing at.
+ * @param ypos The y coordinate to start drawing at.
+ * @param fgcol The forground color.
+ * @param bgcol The background color.
+ * @param buf Unsigned char image buffer, when NULL to not operate on it.
+ * @param fbuf float image buffer, when NULL to not operate on it.
+ * @param w image buffer width.
+ * @param h image buffer height.
+ * @param channels number of channels in the image (3 or 4 - currently)
+ */
+void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/bmfont/intern/BMF_Api.cpp b/intern/bmfont/intern/BMF_Api.cpp
index 46776b08ba0..24e053515fb 100644
--- a/intern/bmfont/intern/BMF_Api.cpp
+++ b/intern/bmfont/intern/BMF_Api.cpp
@@ -150,11 +150,24 @@ int BMF_GetStringWidth(BMF_Font* font, char* str)
return ((BMF_BitmapFont*)font)->GetStringWidth(str);
}
+void BMF_GetStringBoundingBox(BMF_Font* font, char* str, float*llx, float *lly, float *urx, float *ury){
+ if (!font){
+ *llx = *lly = *urx = *ury = 0;
+ }else{
+ ((BMF_BitmapFont*)font)->GetStringBoundingBox(str, llx, lly, urx, ury);
+ }
+}
-void BMF_GetBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r)
+void BMF_GetFontBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r)
{
if (!font) return;
- ((BMF_BitmapFont*)font)->GetBoundingBox(*xmin_r, *ymin_r, *xmax_r, *ymax_r);
+ ((BMF_BitmapFont*)font)->GetFontBoundingBox(*xmin_r, *ymin_r, *xmax_r, *ymax_r);
+}
+
+int BMF_GetFontHeight(BMF_Font* font)
+{
+ if (!font) return -1;
+ return ((BMF_BitmapFont*)font)->GetFontHeight();
}
int BMF_GetFontTexture(BMF_Font* font) {
@@ -166,3 +179,8 @@ void BMF_DrawStringTexture(BMF_Font* font, char *string, float x, float y, float
if (!font) return;
((BMF_BitmapFont*)font)->DrawStringTexture(string, x, y, z);
}
+
+void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) {
+ if (!font) return;
+ ((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h, channels);
+}
diff --git a/intern/bmfont/intern/BMF_BitmapFont.cpp b/intern/bmfont/intern/BMF_BitmapFont.cpp
index bbba2c978dd..afdcf7fbfbb 100644
--- a/intern/bmfont/intern/BMF_BitmapFont.cpp
+++ b/intern/bmfont/intern/BMF_BitmapFont.cpp
@@ -35,6 +35,11 @@
* Copyright (C) 2001 NaN Technologies B.V.
*/
+
+#include <stdio.h>
+
+
+
#include <string.h>
#ifdef HAVE_CONFIG_H
@@ -107,7 +112,7 @@ int BMF_BitmapFont::GetStringWidth(char* str)
return length;
}
-void BMF_BitmapFont::GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax)
+void BMF_BitmapFont::GetFontBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax)
{
xMin = m_fontData->xmin;
yMin = m_fontData->ymin;
@@ -115,6 +120,32 @@ void BMF_BitmapFont::GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yM
yMax = m_fontData->ymax;
}
+int BMF_BitmapFont::GetFontHeight( void )
+{
+ return m_fontData->ymax - m_fontData->ymin;
+}
+
+void BMF_BitmapFont::GetStringBoundingBox(char* str, float*llx, float *lly, float *urx, float *ury)
+{
+ unsigned char c;
+ int length = 0;
+ int ascent = 0;
+ int descent = 0;
+
+ while ( (c = (unsigned char) *str++) ) {
+ length += m_fontData->chars[c].advance;
+ int d = m_fontData->chars[c].yorig;
+ int a = m_fontData->chars[c].height - m_fontData->chars[c].yorig;
+ if(a > ascent) ascent = a;
+ if(d > descent) descent = d;
+ }
+ *llx = (float)0;
+ *lly = (float)-descent;
+ *urx = (float)length;
+ *ury = (float)ascent;
+}
+
+
int BMF_BitmapFont::GetTexture()
{
int fWidth = m_fontData->xmax - m_fontData->xmin;
@@ -208,3 +239,88 @@ void BMF_BitmapFont::DrawStringTexture(char *str, float x, float y, float z)
}
glEnd();
}
+
+#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
+void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels)
+{
+ int x, y;
+
+ if (buf==0 && fbuf==0)
+ return;
+
+ /*offset for font*/
+ posx -= m_fontData->xmin;
+ posy -= m_fontData->ymin;
+
+ if (buf) {
+ unsigned char colch[4];
+ unsigned char *max, *pixel;
+ unsigned char c;
+
+ for (x=0; x<4; x++) {
+ colch[x] = FTOCHAR(col[x]);
+ }
+
+ max = buf + (4 * (w * h));
+ while ((c = (unsigned char) *str++)) {
+ BMF_CharData & cd = m_fontData->chars[c];
+ if (cd.data_offset != -1) {
+ for (y = 0; y < cd.height; y++) {
+ unsigned char* chrRow = &m_fontData->bitmap_data[cd.data_offset + ((cd.width+7)/8)*y];
+ for (x = cd.xorig; x < cd.width; x++) {
+ pixel = buf + 4 * (((posy + y - cd.yorig) * w) + (posx + x));
+ if ((pixel < max) && (pixel > buf)) {
+ int byteIdx = x/8;
+ int bitIdx = 7 - (x%8);
+
+ if (chrRow[byteIdx]&(1<<bitIdx)) {
+ pixel[0] = colch[0];
+ pixel[1] = colch[1];
+ pixel[2] = colch[2];
+ if (channels==4) {
+ pixel[4] = 1; /*colch[3];*/
+ }
+
+ }
+ }
+ }
+ }
+ }
+ posx += cd.advance;
+ }
+ }
+
+ if (fbuf) {
+ float *pixel, *max;
+ unsigned char c;
+ int xi, yi;
+
+ max = fbuf + (4 * (w * h));
+
+ while ((c = (unsigned char) *str++)) {
+ BMF_CharData & cd = m_fontData->chars[c];
+ if (cd.data_offset != -1) {
+ for (yi = 0; yi < cd.height; yi++) {
+ unsigned char* chrRow = &m_fontData->bitmap_data[cd.data_offset + ((cd.width+7)/8)*yi];
+ for (xi = cd.xorig; xi < cd.width; xi++) {
+ pixel = fbuf + 4 * (((posy + yi - cd.yorig) * w) + (posx + xi));
+ if ((pixel < max) && (pixel > fbuf)) {
+ int byteIdx = xi/8;
+ int bitIdx = 7 - (xi%8);
+
+ if (chrRow[byteIdx]&(1<<bitIdx)) {
+ pixel[0] = col[0];
+ pixel[1] = col[1];
+ pixel[2] = col[2];
+ if (channels==4) {
+ pixel[3] = 1; /*col[3];*/
+ }
+ }
+ }
+ }
+ }
+ }
+ posx += cd.advance;
+ }
+ }
+}
diff --git a/intern/bmfont/intern/BMF_BitmapFont.h b/intern/bmfont/intern/BMF_BitmapFont.h
index 30cfd650353..f8d3d5370dd 100644
--- a/intern/bmfont/intern/BMF_BitmapFont.h
+++ b/intern/bmfont/intern/BMF_BitmapFont.h
@@ -76,7 +76,24 @@ public:
* box represent the extent of the font and its positioning
* about the origin.
*/
- void GetBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax);
+ void GetFontBoundingBox(int & xMin, int & yMin, int & xMax, int & yMax);
+
+ /**
+ * Return the bounding box height of the font.
+ */
+ int GetFontHeight(void);
+
+ /**
+ * Returns the bounding box of a string of characters.
+ * @param font The font to use.
+ * @param str The string.
+ * @param llx Lower left x coord
+ * @param lly Lower left y coord
+ * @param urx Upper right x coord
+ * @param ury Upper right y coord
+ */
+ void GetStringBoundingBox(char* str, float*llx, float *lly, float *urx, float *ury);
+
/**
* Convert the font to a texture, and return the GL texture
@@ -101,6 +118,22 @@ public:
*/
void DrawStringTexture(char* string, float x, float y, float z);
+ /**
+ * Draw the given @a string at the point @a xpos, @a ypos using
+ * char and float buffers.
+ *
+ * @param string The c-string to draw.
+ * @param xpos The x coordinate to start drawing at.
+ * @param ypos The y coordinate to start drawing at.
+ * @param col The forground color.
+ * @param buf Unsigned char image buffer, when NULL to not operate on it.
+ * @param fbuf float image buffer, when NULL to not operate on it.
+ * @param w image buffer width.
+ * @param h image buffer height.
+ * @param channels number of channels in the image (3 or 4 - currently)
+ */
+ void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels);
+
protected:
/** Pointer to the font data. */
BMF_FontData* m_fontData;
diff --git a/intern/boolop/intern/BOP_BSPNode.cpp b/intern/boolop/intern/BOP_BSPNode.cpp
index af5c40baad9..68a20d7a5a4 100644
--- a/intern/boolop/intern/BOP_BSPNode.cpp
+++ b/intern/boolop/intern/BOP_BSPNode.cpp
@@ -58,30 +58,82 @@ BOP_BSPNode::~BOP_BSPNode()
/**
* Adds a new face to this BSP tree.
- * @param p1 first face point.
- * @param p2 second face point.
- * @param p3 third face point.
+ * @param pts vector containing face points
* @param plane face plane.
*/
-unsigned int BOP_BSPNode::addFace(const MT_Point3& p1,
- const MT_Point3& p2,
- const MT_Point3& p3,
- const MT_Plane3& plane)
+
+unsigned int BOP_BSPNode::addFace(BOP_BSPPoints pts,
+ const MT_Plane3& plane )
{
unsigned int newDeep = 0;
- BOP_TAG tag = BOP_createTAG(testPoint(p1), testPoint(p2), testPoint(p3));
- if ((tag & IN_IN_IN) != 0) {
+ BOP_TAG tag = ON;
+
+ // find out if any points on the "face" lie in either half-space
+ BOP_IT_BSPPoints ptsEnd = pts.end();
+ for(BOP_IT_BSPPoints itp=pts.begin();itp!=ptsEnd;itp++){
+ tag = (BOP_TAG) ((int) tag | (int)testPoint(*itp));
+ }
+
+ if (tag == ON) { } // face lies on hyperplane: do nothing
+ else if ((tag & IN) != 0 && (tag & OUT) == 0) { // face is entirely on inside
if (m_inChild != NULL)
- newDeep = m_inChild->addFace(p1, p2, p3, plane) + 1;
+ newDeep = m_inChild->addFace(pts, plane) + 1;
+ else {
+ m_inChild = new BOP_BSPNode(plane);
+ newDeep = 2;
+ }
+ } else if ((tag & OUT) != 0 && (tag & IN) == 0) { // face is entirely on outside
+ if (m_outChild != NULL)
+ newDeep = m_outChild->addFace(pts, plane) + 1;
+ else {
+ m_outChild = new BOP_BSPNode(plane);
+ newDeep = 2;
+ }
+ } else { // face lies in both half-spaces: split it
+ BOP_BSPPoints inside, outside;
+ MT_Point3 lpoint= pts[pts.size()-1];
+ BOP_TAG ltag = testPoint(lpoint);
+ BOP_TAG tstate = ltag;
+
+ // classify each line segment, looking for endpoints which lie on different
+ // sides of the hyperplane.
+
+ ptsEnd = pts.end();
+ for(BOP_IT_BSPPoints itp=pts.begin();itp!=ptsEnd;itp++){
+ MT_Point3 npoint= *itp;
+ BOP_TAG ntag = testPoint(npoint);
+
+ if(ltag != ON) { // last point not on hyperplane
+ if(tstate == IN) {
+ if (m_inChild != NULL) inside.push_back(lpoint);
+ } else {
+ if (m_outChild != NULL) outside.push_back(lpoint);
+ }
+ if(ntag != ON && ntag != tstate) { // last, self in different half-spaces
+ MT_Point3 mpoint = BOP_intersectPlane( m_plane, lpoint, npoint );
+ if (m_inChild != NULL) inside.push_back(mpoint);
+ if (m_outChild != NULL) outside.push_back(mpoint);
+ tstate = ntag;
+ }
+ } else { // last point on hyperplane, so we're switching
+ // half-spaces
+ // boundary point belong to both faces
+ if (m_inChild != NULL) inside.push_back(lpoint);
+ if (m_outChild != NULL) outside.push_back(lpoint);
+ tstate = ntag; // state changes to new point tag
+ }
+ lpoint = npoint; // save point, tag for next iteration
+ ltag = ntag;
+ }
+
+ if (m_inChild != NULL)
+ newDeep = m_inChild->addFace(inside, plane) + 1;
else {
m_inChild = new BOP_BSPNode(plane);
newDeep = 2;
}
- }
-
- if ((tag & OUT_OUT_OUT) != 0){
if (m_outChild != NULL)
- newDeep = MT_max(newDeep, m_outChild->addFace(p1, p2, p3, plane) + 1);
+ newDeep = MT_max(newDeep, m_outChild->addFace(outside, plane) + 1);
else {
m_outChild = new BOP_BSPNode(plane);
newDeep = MT_max(newDeep,(unsigned int)2);
@@ -653,19 +705,13 @@ int BOP_BSPNode::splitTriangle(MT_Point3* res,
*/
void BOP_BSPNode::print(unsigned int deep)
{
- for (unsigned int i = 0; i < deep; ++i)
- cout << " ";
-
- cout << m_plane.x() << ", ";
- cout << m_plane.y() << ", ";
- cout << m_plane.z() << ", ";
- cout << m_plane.w() << endl;
- if (m_inChild != NULL) {
- cout << "IN:";
+ cout << "(" << deep << "," << m_plane << ")," << endl;
+ if (m_inChild != NULL)
m_inChild->print(deep + 1);
- }
- if (m_outChild != NULL) {
- cout << "OUT:";
+ else
+ cout << "(" << deep+1 << ",None)," << endl;
+ if (m_outChild != NULL)
m_outChild->print(deep + 1);
- }
+ else
+ cout << "(" << deep+1 << ",None)," << endl;
}
diff --git a/intern/boolop/intern/BOP_BSPNode.h b/intern/boolop/intern/BOP_BSPNode.h
index d4f7f1c28a1..39a84b94dec 100644
--- a/intern/boolop/intern/BOP_BSPNode.h
+++ b/intern/boolop/intern/BOP_BSPNode.h
@@ -35,6 +35,9 @@
#include "BOP_Tag.h"
#include "BOP_Face.h"
+typedef vector<MT_Point3> BOP_BSPPoints;
+typedef vector<MT_Point3>::iterator BOP_IT_BSPPoints;
+
class BOP_BSPNode
{
protected:
@@ -47,9 +50,7 @@ public:
// Construction methods
BOP_BSPNode(const MT_Plane3& plane);
~BOP_BSPNode();
- unsigned int addFace(const MT_Point3& p1,
- const MT_Point3& p2,
- const MT_Point3& p3,
+ unsigned int addFace(BOP_BSPPoints pts,
const MT_Plane3& plane);
BOP_TAG classifyFace(const MT_Point3& p1,
const MT_Point3& p2,
diff --git a/intern/boolop/intern/BOP_BSPTree.cpp b/intern/boolop/intern/BOP_BSPTree.cpp
index 4e5c171bc83..3ae375294cd 100644
--- a/intern/boolop/intern/BOP_BSPTree.cpp
+++ b/intern/boolop/intern/BOP_BSPTree.cpp
@@ -69,6 +69,7 @@ void BOP_BSPTree::addMesh(BOP_Mesh* mesh, BOP_Faces& facesList)
* @param mesh Input data for BSP tree.
* @param face index to mesh face.
*/
+
void BOP_BSPTree::addFace(BOP_Mesh* mesh, BOP_Face* face)
{
addFace(mesh->getVertex(face->getVertex(0))->getPoint(),
@@ -91,8 +92,15 @@ void BOP_BSPTree::addFace(const MT_Point3& p1,
{
if (m_root == NULL)
m_root = new BOP_BSPNode(plane);
- else
- m_root->addFace(p1,p2,p3,plane);
+ else {
+ BOP_BSPPoints pts;
+
+ pts.push_back(p1);
+ pts.push_back(p2);
+ pts.push_back(p3);
+
+ m_root->addFace(pts,plane);
+ }
// update bounding box
m_bbox.add(p1);
@@ -171,37 +179,6 @@ unsigned int BOP_BSPTree::getDeep() const
}
/**
- * Computes the bounding BSP data.
- */
-void BOP_BSPTree::computeBox()
-{
- if ( m_root != NULL ) {
- MT_Point3 p1(m_bbox.m_minX,m_bbox.m_minY,m_bbox.m_minZ);
- MT_Point3 p2(m_bbox.m_maxX,m_bbox.m_minY,m_bbox.m_minZ);
- MT_Point3 p3(m_bbox.m_maxX,m_bbox.m_maxY,m_bbox.m_minZ);
- MT_Point3 p4(m_bbox.m_minX,m_bbox.m_maxY,m_bbox.m_minZ);
- MT_Point3 p5(m_bbox.m_minX,m_bbox.m_minY,m_bbox.m_maxZ);
- MT_Point3 p6(m_bbox.m_maxX,m_bbox.m_minY,m_bbox.m_maxZ);
- MT_Point3 p7(m_bbox.m_maxX,m_bbox.m_maxY,m_bbox.m_maxZ);
- MT_Point3 p8(m_bbox.m_minX,m_bbox.m_maxY,m_bbox.m_maxZ);
-
- MT_Plane3 plane1(p3,p2,p1);
- MT_Plane3 plane2(p5,p6,p7);
- MT_Plane3 plane3(p1,p2,p6);
- MT_Plane3 plane4(p8,p7,p3);
- MT_Plane3 plane5(p2,p3,p7);
- MT_Plane3 plane6(p1,p5,p8);
-
- BOP_BSPNode bsp(plane1);
- bsp.addFace(p5,p6,p7,plane2);
- bsp.addFace(p1,p2,p6,plane3);
- bsp.addFace(p8,p7,p3,plane4);
- bsp.addFace(p2,p3,p7,plane5);
- bsp.addFace(p1,p5,p8,plane6);
- }
-}
-
-/**
* Prints debug information.
*/
void BOP_BSPTree::print()
diff --git a/intern/boolop/intern/BOP_BSPTree.h b/intern/boolop/intern/BOP_BSPTree.h
index 7e5b5a4fa76..412d5a40753 100644
--- a/intern/boolop/intern/BOP_BSPTree.h
+++ b/intern/boolop/intern/BOP_BSPTree.h
@@ -65,7 +65,6 @@ public:
const MT_Point3& p3,
const MT_Plane3& plane) const;
unsigned int getDeep() const;
- void computeBox();
void print();
inline void setRoot(BOP_BSPNode* root) {m_root=root;};
inline BOP_BSPNode* getRoot() const {return m_root;};
diff --git a/intern/boolop/intern/BOP_Face.cpp b/intern/boolop/intern/BOP_Face.cpp
index 80c917f2838..ebe34237d4f 100644
--- a/intern/boolop/intern/BOP_Face.cpp
+++ b/intern/boolop/intern/BOP_Face.cpp
@@ -44,6 +44,8 @@ BOP_Face::BOP_Face(MT_Plane3 plane, BOP_Index originalFace)
m_plane = plane;
m_tag = UNCLASSIFIED;
m_originalFace = originalFace;
+ m_split = 0;
+ m_bbox = NULL;
}
/**
@@ -197,6 +199,14 @@ bool BOP_Face3::getNextVertex(BOP_Index v, BOP_Index &w)
*/
void BOP_Face3::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
{
+ /* if the old index really exists, and new index also exists already,
+ * don't create an edge with both vertices == newIndex */
+
+ if( (m_indexs[0] == oldIndex || m_indexs[1] == oldIndex || m_indexs[2] == oldIndex) &&
+ (m_indexs[0] == newIndex || m_indexs[1] == newIndex || m_indexs[2] == newIndex) ) {
+ setTAG(BROKEN);
+ }
+
if (m_indexs[0] == oldIndex) m_indexs[0] = newIndex;
else if (m_indexs[1] == oldIndex) m_indexs[1] = newIndex;
else if (m_indexs[2] == oldIndex) m_indexs[2] = newIndex;
diff --git a/intern/boolop/intern/BOP_Face.h b/intern/boolop/intern/BOP_Face.h
index 7db5ab1fe5c..1d854ec00ca 100644
--- a/intern/boolop/intern/BOP_Face.h
+++ b/intern/boolop/intern/BOP_Face.h
@@ -34,6 +34,7 @@
#include "BOP_Tag.h"
#include "MT_Plane3.h"
#include "BOP_Indexs.h"
+#include "BOP_BBox.h"
#include <iostream>
#include <vector>
using namespace std;
@@ -53,10 +54,12 @@ private:
protected:
BOP_Index m_indexs[4];
unsigned int m_size;
+ unsigned int m_split;
+ BOP_BBox *m_bbox;
public:
BOP_Face(MT_Plane3 plane, BOP_Index originalFace);
- virtual ~BOP_Face(){};
+ virtual ~BOP_Face(){if (m_bbox) delete m_bbox;};
inline MT_Plane3 getPlane() const {return m_plane;};
inline void setPlane(const MT_Plane3 plane) {m_plane = plane;};
inline BOP_TAG getTAG() const {return m_tag;};
@@ -65,7 +68,15 @@ public:
inline void setOriginalFace(const BOP_Index originalFace) {m_originalFace=originalFace;};
inline BOP_Index getVertex(unsigned int i) const {return m_indexs[i];};
inline void setVertex(const BOP_Index idx, const BOP_Index i) {m_indexs[idx]=i;};
+ inline unsigned int getSplit() const {return m_split;};
+ inline void setSplit(const unsigned int i) {m_split=i;};
+
void invert();
+ inline void setBBox(const MT_Point3& p1,const MT_Point3& p2,const MT_Point3& p3) {
+ m_bbox = new BOP_BBox(p1, p2, p3);};
+ inline BOP_BBox *getBBox() {return m_bbox;};
+ inline void freeBBox(){if (m_bbox!=NULL) {delete m_bbox; m_bbox=NULL;} };
+
inline unsigned int size() const {return m_size;};
virtual bool getEdgeIndex(BOP_Index v1, BOP_Index v2, unsigned int &e) = 0;
diff --git a/intern/boolop/intern/BOP_Face2Face.cpp b/intern/boolop/intern/BOP_Face2Face.cpp
index 7e2b6bd7b2f..ef67e5dd24b 100644
--- a/intern/boolop/intern/BOP_Face2Face.cpp
+++ b/intern/boolop/intern/BOP_Face2Face.cpp
@@ -1,4 +1,7 @@
/**
+ *
+ * $Id$
+ *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -23,7 +26,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Marc Freixas, Ken Hughes
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -144,9 +147,18 @@ void BOP_mergeVertexs(BOP_Mesh *mesh, unsigned int firstFace);
* @param mesh mesh that contains the faces, edges and vertices
* @param facesA set of faces from object A
* @param facesB set of faces from object B
+ *
+ * Two optimizations were added here:
+ * 1) keep the bounding box for a face once it's created; this is
+ * especially important for B faces, since they were being created and
+ * recreated over and over
+ * 2) associate a "split" index in the faceB vector with each A face; when
+ * an A face is split, we will not need to recheck any B faces have
+ * already been checked against that original A face
*/
+
void BOP_Face2Face(BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)
-{
+{
for(unsigned int idxFaceA=0;idxFaceA<facesA->size();idxFaceA++) {
BOP_Face *faceA = (*facesA)[idxFaceA];
MT_Plane3 planeA = faceA->getPlane();
@@ -154,23 +166,33 @@ void BOP_Face2Face(BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)
MT_Point3 p2 = mesh->getVertex(faceA->getVertex(1))->getPoint();
MT_Point3 p3 = mesh->getVertex(faceA->getVertex(2))->getPoint();
- BOP_BBox boxA(p1,p2,p3);
-
- for(unsigned int idxFaceB=0;
+ /* get (or create) bounding box for face A */
+ if( faceA->getBBox() == NULL )
+ faceA->setBBox(p1,p2,p3);
+ BOP_BBox *boxA = faceA->getBBox();
+
+ /* start checking B faces with the previously stored split index */
+
+ for(unsigned int idxFaceB=faceA->getSplit();
idxFaceB<facesB->size() && (faceA->getTAG() != BROKEN) && (faceA->getTAG() != PHANTOM);) {
BOP_Face *faceB = (*facesB)[idxFaceB];
+ faceA->setSplit(idxFaceB);
if ((faceB->getTAG() != BROKEN) && (faceB->getTAG() != PHANTOM)) {
- BOP_BBox boxB(mesh->getVertex(faceB->getVertex(0))->getPoint(),
- mesh->getVertex(faceB->getVertex(1))->getPoint(),
- mesh->getVertex(faceB->getVertex(2))->getPoint());
- if (boxA.intersect(boxB)) {
+ /* get (or create) bounding box for face B */
+ if( faceB->getBBox() == NULL )
+ faceB->setBBox(mesh->getVertex(faceB->getVertex(0))->getPoint(),
+ mesh->getVertex(faceB->getVertex(1))->getPoint(),
+ mesh->getVertex(faceB->getVertex(2))->getPoint());
+ BOP_BBox *boxB = faceB->getBBox();
+
+ if (boxA->intersect(*boxB)) {
MT_Plane3 planeB = faceB->getPlane();
if (BOP_containsPoint(planeB,p1) &&
BOP_containsPoint(planeB,p2) &&
BOP_containsPoint(planeB,p3)) {
if (BOP_orientation(planeB,planeA)>0) {
- BOP_intersectCoplanarFaces(mesh,facesB,faceA,faceB,false);
+ BOP_intersectCoplanarFaces(mesh,facesB,faceA,faceB,false);
}
}
else {
@@ -178,10 +200,7 @@ void BOP_Face2Face(BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)
}
}
}
- if (faceB->getTAG()==BROKEN){
- facesB->erase(facesB->begin()+idxFaceB);
- }else
- idxFaceB++;
+ idxFaceB++;
}
}
@@ -385,56 +404,11 @@ void BOP_mergeVertexs(BOP_Mesh *mesh, unsigned int firstFace)
for(unsigned int idxFace = firstFace; idxFace < numFaces; idxFace++) {
BOP_Face *face = mesh->getFace(idxFace);
if ((face->getTAG() != BROKEN) && (face->getTAG() != PHANTOM)) {
- BOP_Index v1 = face->getVertex(0);
- BOP_Index v2 = face->getVertex(1);
- BOP_Index v3 = face->getVertex(2);
- MT_Point3 vertex1 = mesh->getVertex(v1)->getPoint();
- MT_Point3 vertex2 = mesh->getVertex(v2)->getPoint();
- MT_Point3 vertex3 = mesh->getVertex(v3)->getPoint();
- int dist12 = BOP_comp(vertex1,vertex2);
- int dist13 = BOP_comp(vertex1,vertex3);
- int dist23 = BOP_comp(vertex2,vertex3);
-
- if (dist12 == 0) {
- if (dist13 == 0) {
- // v1 ~= v2 , v1 ~= v3 , v2 ~= v3
- mesh->replaceVertexIndex(v2,v1);
- mesh->replaceVertexIndex(v3,v1);
- }
- else {
- if (dist23 == 0) {
- mesh->replaceVertexIndex(v1,v2);
- mesh->replaceVertexIndex(v3,v2);
- }
- else {
- mesh->replaceVertexIndex(v1,v2);
- }
- }
- }
- else {
- if (dist13 == 0) {
- // v1 ~= v3
- if (dist23 == 0) {
- mesh->replaceVertexIndex(v1,v3);
- mesh->replaceVertexIndex(v2,v3);
- }
- else {
- mesh->replaceVertexIndex(v1,v3);
- }
- }
- else {
- if (dist23 == 0) {
- // v2 ~= v3
- mesh->replaceVertexIndex(v2,v3);
- } else {
- // all differents
- if (BOP_collinear(vertex1,vertex2,vertex3)) {
- // collinear triangle
- face->setTAG(PHANTOM);
- }
- }
- }
- }
+ MT_Point3 vertex1 = mesh->getVertex(face->getVertex(0))->getPoint();
+ MT_Point3 vertex2 = mesh->getVertex(face->getVertex(1))->getPoint();
+ MT_Point3 vertex3 = mesh->getVertex(face->getVertex(2))->getPoint();
+ if (BOP_collinear(vertex1,vertex2,vertex3)) // collinear triangle
+ face->setTAG(PHANTOM);
}
}
}
@@ -507,7 +481,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
if (size == 2) {
// Trivial case, only test the merge ...
- if (BOP_comp(0,points[0].distance(points[1]))==0) {
+ if (BOP_fuzzyZero(points[0].distance(points[1]))) {
face[0] = 3;
size--;
}
@@ -592,8 +566,8 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
// Merge data
MT_Scalar d1 = sortedPoints[1].distance(sortedPoints[0]);
MT_Scalar d2 = sortedPoints[1].distance(sortedPoints[2]);
- if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[0]) {
- if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
+ if (BOP_fuzzyZero(d1) && sortedFaces[1] != sortedFaces[0]) {
+ if (BOP_fuzzyZero(d2) && sortedFaces[1] != sortedFaces[2]) {
if (d1 < d2) {
// merge 0 and 1
sortedFaces[0] = 3;
@@ -605,7 +579,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
if (size == 3) {
// merge 1 and 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
- if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
+ if (BOP_fuzzyZero(d1) && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
@@ -633,7 +607,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
if (size == 3) {
// merge 1 i 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
- if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
+ if (BOP_fuzzyZero(d1) && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
@@ -642,7 +616,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
}
}
else {
- if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
+ if (BOP_fuzzyZero(d2) && sortedFaces[1] != sortedFaces[2]) {
// merge 1 and 2
sortedFaces[1] = 3;
for(i = 2; i<size-1;i++) {
@@ -653,7 +627,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
}
else if (size == 4) {
d1 = sortedPoints[2].distance(sortedPoints[3]);
- if (BOP_comp(0,d1)==0 && sortedFaces[2] != sortedFaces[3]) {
+ if (BOP_fuzzyZero(d1) && sortedFaces[2] != sortedFaces[3]) {
// merge 2 and 3
sortedFaces[2] = 3;
size--;
diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp
index 6d1ae56da2d..3c61fd6c7b8 100644
--- a/intern/boolop/intern/BOP_Interface.cpp
+++ b/intern/boolop/intern/BOP_Interface.cpp
@@ -152,12 +152,10 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC,
// Create BSPs trees for mesh A & B
BOP_BSPTree bspA;
bspA.addMesh(meshC, *facesA);
- bspA.computeBox();
BOP_BSPTree bspB;
bspB.addMesh(meshC, *facesB);
- bspB.computeBox();
-
+
#ifdef DEBUG
c = chrono.stamp(); t += c;
cout << "Create BSP " << c << endl;
diff --git a/intern/boolop/intern/BOP_MathUtils.cpp b/intern/boolop/intern/BOP_MathUtils.cpp
index 7a0210247eb..e0d96b465ee 100644
--- a/intern/boolop/intern/BOP_MathUtils.cpp
+++ b/intern/boolop/intern/BOP_MathUtils.cpp
@@ -1,4 +1,7 @@
/**
+ *
+ * $Id$
+ *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -23,7 +26,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Marc Freixas, Ken Hughes
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -40,9 +43,38 @@ using namespace std;
*/
int BOP_comp(const MT_Scalar A, const MT_Scalar B)
{
+#ifndef VAR_EPSILON
if (A >= B + BOP_EPSILON) return 1;
else if (B >= A + BOP_EPSILON) return -1;
else return 0;
+#else
+ int expA, expB;
+ float mant;
+ frexp(A, &expA); /* get exponents of each number */
+ frexp(B, &expB);
+
+ if(expA < expB) /* find the larger exponent */
+ expA = expB;
+ mant = frexp((A-B), &expB); /* get exponent of the difference */
+ /* mantissa will only be zero is (A-B) is really zero; otherwise, also
+ * also allow a "reasonably" small exponent or "reasonably large"
+ * difference in exponents to be considers "close to zero" */
+ if( mant == 0 || expB < -30 || expA - expB > 31) return 0;
+ else if( mant > 0) return 1;
+ else return -1;
+#endif
+}
+
+/**
+ * Compares a scalar with EPSILON accuracy.
+ * @param A scalar
+ * @return 1 if A > 0, -1 if A < 0, 0 otherwise
+ */
+int BOP_comp0(const MT_Scalar A)
+{
+ if (A >= BOP_EPSILON) return 1;
+ else if (0 >= A + BOP_EPSILON) return -1;
+ else return 0;
}
/**
@@ -53,6 +85,7 @@ int BOP_comp(const MT_Scalar A, const MT_Scalar B)
*/
int BOP_comp(const MT_Tuple3& A, const MT_Tuple3& B)
{
+#ifndef VAR_EPSILON
if (A.x() >= (B.x() + BOP_EPSILON)) return 1;
else if (B.x() >= (A.x() + BOP_EPSILON)) return -1;
else if (A.y() >= (B.y() + BOP_EPSILON)) return 1;
@@ -60,6 +93,13 @@ int BOP_comp(const MT_Tuple3& A, const MT_Tuple3& B)
else if (A.z() >= (B.z() + BOP_EPSILON)) return 1;
else if (B.z() >= (A.z() + BOP_EPSILON)) return -1;
else return 0;
+#else
+ int result = BOP_comp(A.x(), B.x());
+ if (result != 0) return result;
+ result = BOP_comp(A.y(), B.y());
+ if (result != 0) return result;
+ return BOP_comp(A.z(), B.z());
+#endif
}
/**
@@ -113,12 +153,20 @@ bool BOP_between(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3)
*/
bool BOP_collinear(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3)
{
+ if( BOP_comp(p1,p2) == 0 || BOP_comp(p2,p3) == 0 ) return true;
+
MT_Vector3 v1 = p2 - p1;
MT_Vector3 v2 = p3 - p2;
-
+
+ /* normalize vectors before taking their cross product, so its length
+ * has some actual meaning */
+ // if(MT_fuzzyZero(v1.length()) || MT_fuzzyZero(v2.length())) return true;
+ v1.normalize();
+ v2.normalize();
+
MT_Vector3 w = v1.cross(v2);
- return (BOP_comp(w.x(),0.0) == 0) && (BOP_comp(w.y(),0.0) == 0) && (BOP_comp(w.z(),0.0) == 0);
+ return (BOP_fuzzyZero(w.x()) && BOP_fuzzyZero(w.y()) && BOP_fuzzyZero(w.z()));
}
/**
@@ -184,17 +232,17 @@ bool BOP_intersect(const MT_Vector3& vL1, const MT_Point3& pL1, const MT_Vector3
MT_Scalar t = -1;
MT_Scalar den = (vL1.y()*vL2.x() - vL1.x() * vL2.y());
- if (BOP_comp(den,0)) {
+ if (!BOP_fuzzyZero(den)) {
t = (pL2.y()*vL1.x() - vL1.y()*pL2.x() + pL1.x()*vL1.y() - pL1.y()*vL1.x()) / den ;
}
else {
den = (vL1.y()*vL2.z() - vL1.z() * vL2.y());
- if (BOP_comp(den,0)) {
+ if (!BOP_fuzzyZero(den)) {
t = (pL2.y()*vL1.z() - vL1.y()*pL2.z() + pL1.z()*vL1.y() - pL1.y()*vL1.z()) / den ;
}
else {
den = (vL1.x()*vL2.z() - vL1.z() * vL2.x());
- if (BOP_comp(den,0)) {
+ if (!BOP_fuzzyZero(den)) {
t = (pL2.x()*vL1.z() - vL1.x()*pL2.z() + pL1.z()*vL1.x() - pL1.x()*vL1.z()) / den ;
}
else {
@@ -318,7 +366,7 @@ MT_Scalar BOP_orientation(const MT_Plane3& p1, const MT_Plane3& p2)
int BOP_classify(const MT_Point3& p, const MT_Plane3& plane)
{
// Compare plane - point distance with zero
- return BOP_comp(plane.signedDistance(p),0);
+ return BOP_comp0(plane.signedDistance(p));
}
/**
@@ -360,7 +408,7 @@ MT_Point3 BOP_intersectPlane(const MT_Plane3& plane, const MT_Point3& p1, const
*/
bool BOP_containsPoint(const MT_Plane3& plane, const MT_Point3& point)
{
- return BOP_comp(plane.signedDistance(point),0) == 0;
+ return BOP_fuzzyZero(plane.signedDistance(point));
}
/**
@@ -416,8 +464,8 @@ MT_Scalar BOP_EpsilonDistance(const MT_Point3& p0, const MT_Point3& p1, const MT
MT_Scalar d1 = p0.distance(q);
MT_Scalar d;
- if (BOP_comp(d0,0)==0) d = 1.0;
- else if (BOP_comp(d1,0)==0) d = 0.0;
+ if (BOP_fuzzyZero(d0)) d = 1.0;
+ else if (BOP_fuzzyZero(d1)) d = 0.0;
else d = d1 / d0;
return d;
}
diff --git a/intern/boolop/intern/BOP_MathUtils.h b/intern/boolop/intern/BOP_MathUtils.h
index 61458bd8a78..3cff2d6a23b 100644
--- a/intern/boolop/intern/BOP_MathUtils.h
+++ b/intern/boolop/intern/BOP_MathUtils.h
@@ -1,4 +1,7 @@
/**
+ *
+ * $Id$
+ *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -23,7 +26,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Marc Freixas, Ken Hughes
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -36,16 +39,23 @@
#include "MT_Point3.h"
#include "MT_Plane3.h"
+/* define this to give better precision comparisons */
+#define VAR_EPSILON
+
+#ifndef VAR_EPSILON
const MT_Scalar BOP_EPSILON(1.0e-5);
+#else
+const MT_Scalar BOP_EPSILON(9.3132257461547852e-10); /* ~= 2**-30 */
+#endif
inline int BOP_sign(MT_Scalar x) {
return x < 0.0 ? -1 : x > 0.0 ? 1 : 0;
}
inline MT_Scalar BOP_abs(MT_Scalar x) { return fabs(x); }
-inline bool BOP_fuzzyZero(MT_Scalar x) { return BOP_abs(x) < BOP_EPSILON; }
-
int BOP_comp(const MT_Scalar A, const MT_Scalar B);
int BOP_comp(const MT_Tuple3& A, const MT_Tuple3& B);
+int BOP_comp0(const MT_Scalar A);
+inline bool BOP_fuzzyZero(MT_Scalar x) { return BOP_comp0(x) == 0; }
int BOP_exactComp(const MT_Scalar A, const MT_Scalar B);
int BOP_exactComp(const MT_Tuple3& A, const MT_Tuple3& B);
bool BOP_between(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3);
diff --git a/intern/boolop/intern/BOP_Merge.cpp b/intern/boolop/intern/BOP_Merge.cpp
index fb5bfbc0e7b..c2b1a2db2b7 100644
--- a/intern/boolop/intern/BOP_Merge.cpp
+++ b/intern/boolop/intern/BOP_Merge.cpp
@@ -1,4 +1,7 @@
/**
+ *
+ * $Id$
+ *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -23,7 +26,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Marc Freixas, Ken Hughes
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -592,6 +595,7 @@ bool BOP_Merge::createQuads()
// Get mesh faces
BOP_Faces faces = m_mesh->getFaces();
+
// Merge mesh triangles
const BOP_IT_Faces facesIEnd = (faces.end()-1);
diff --git a/intern/boolop/intern/BOP_Mesh.cpp b/intern/boolop/intern/BOP_Mesh.cpp
index 3b194ef72d4..0b70cc61533 100644
--- a/intern/boolop/intern/BOP_Mesh.cpp
+++ b/intern/boolop/intern/BOP_Mesh.cpp
@@ -681,6 +681,23 @@ unsigned int BOP_Mesh::getNumFaces(BOP_TAG tag)
}
/**
+ * Marks faces which bad edges as BROKEN (invalid face, no further processing).
+ * @param edge edge which is being replaced
+ * @param mesh mesh containing faces
+ */
+
+static void removeBrokenFaces( BOP_Edge *edge, BOP_Mesh *mesh )
+{
+ BOP_Faces m_faces = mesh->getFaces();
+
+ BOP_Indexs edgeFaces = edge->getFaces();
+ const BOP_IT_Indexs edgeFacesEnd = edgeFaces.end();
+ for(BOP_IT_Indexs idxFace=edgeFaces.begin();idxFace!=edgeFacesEnd;
+ idxFace++)
+ m_faces[*idxFace]->setTAG(BROKEN);
+}
+
+/**
* Replaces a vertex index.
* @param oldIndex old vertex index
* @param newIndex new vertex index
@@ -695,9 +712,6 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
BOP_Vertex *newVertex = m_vertexs[newIndex];
BOP_Indexs oldEdges = oldVertex->getEdges();
- BOP_Index edgeIdx=0;
- bool found = false;
-
// Update faces to the newIndex
BOP_IT_Indexs oldEdgesEnd = oldEdges.end();
for(oldEdgeIndex=oldEdges.begin();oldEdgeIndex!=oldEdgesEnd;
@@ -706,14 +720,9 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
if ((edge->getVertex1()==oldIndex && edge->getVertex2()==newIndex) ||
(edge->getVertex2()==oldIndex && edge->getVertex1()==newIndex)) {
// Remove old edge ==> set edge faces to BROKEN
- BOP_Indexs edgeFaces = edge->getFaces();
- const BOP_IT_Indexs edgeFacesEnd = edgeFaces.end();
- for(BOP_IT_Indexs idxFace=edgeFaces.begin();idxFace!=edgeFacesEnd;
- idxFace++) {
- m_faces[*idxFace]->setTAG(BROKEN);
- }
- edgeIdx = *oldEdgeIndex;
- found = true;
+ removeBrokenFaces( edge, this );
+ oldVertex->removeEdge(*oldEdgeIndex);
+ newVertex->removeEdge(*oldEdgeIndex);
}
else {
BOP_Indexs faces = edge->getFaces();
@@ -724,10 +733,6 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
}
}
}
- if (found) {
- oldVertex->removeEdge(edgeIdx);
- newVertex->removeEdge(edgeIdx);
- }
oldEdgesEnd = oldEdges.end();
for(oldEdgeIndex=oldEdges.begin();oldEdgeIndex!=oldEdgesEnd;
@@ -739,6 +744,10 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
v1 = (v1==oldIndex?edge->getVertex2():v1);
if ((edge2 = getEdge(newIndex,v1)) == NULL) {
edge->replaceVertexIndex(oldIndex,newIndex);
+ if ( edge->getVertex1() == edge->getVertex2() ) {
+ removeBrokenFaces( edge, this );
+ oldVertex->removeEdge(*oldEdgeIndex);
+ }
#ifdef HASH
rehashVertex(oldIndex,newIndex,v1);
#endif
@@ -754,6 +763,11 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
BOP_Vertex *oppositeVertex = m_vertexs[v1];
oppositeVertex->removeEdge(*oldEdgeIndex);
edge->replaceVertexIndex(oldIndex,newIndex);
+ if ( edge->getVertex1() == edge->getVertex2() ) {
+ removeBrokenFaces( edge, this );
+ oldVertex->removeEdge(*oldEdgeIndex);
+ newVertex->removeEdge(*oldEdgeIndex);
+ }
#ifdef HASH
rehashVertex(oldIndex,newIndex,v1);
#endif
@@ -1063,3 +1077,4 @@ void BOP_Mesh::updatePlanes()
face->setPlane(plane);
}
}
+
diff --git a/intern/boolop/intern/BOP_Triangulator.cpp b/intern/boolop/intern/BOP_Triangulator.cpp
index ad23e69d8c0..fd7b3154195 100644
--- a/intern/boolop/intern/BOP_Triangulator.cpp
+++ b/intern/boolop/intern/BOP_Triangulator.cpp
@@ -90,8 +90,11 @@ void BOP_triangulateA(BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face * face, BOP_Ind
BOP_addFace(mesh, faces, face1, face->getTAG());
BOP_addFace(mesh, faces, face2, face->getTAG());
+ face1->setSplit(face->getSplit());
+ face2->setSplit(face->getSplit());
face->setTAG(BROKEN);
+ face->freeBBox();
}
/**
@@ -122,7 +125,11 @@ void BOP_triangulateB(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face, BOP_Inde
BOP_addFace(mesh,faces,face1,face->getTAG());
BOP_addFace(mesh,faces,face2,face->getTAG());
BOP_addFace(mesh,faces,face3,face->getTAG());
+ face1->setSplit(face->getSplit());
+ face2->setSplit(face->getSplit());
+ face3->setSplit(face->getSplit());
face->setTAG(BROKEN);
+ face->freeBBox();
}
@@ -180,26 +187,33 @@ void BOP_triangulateC_split(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face,
{
BOP_Index v = BOP_getTriangleVertex(mesh, v1, v2, v4, v5);
BOP_Index w = (v == v4 ? v5 : v4);
+ BOP_Face *face1 = new BOP_Face3(v1, v, w, face->getPlane(), face->getOriginalFace());
+ BOP_Face *face2 = new BOP_Face3(v1, v2, v, face->getPlane(), face->getOriginalFace());
+ BOP_Face *face3 = new BOP_Face3(v1, w, v3, face->getPlane(), face->getOriginalFace());
// v1 v w defines the nice triangle in the correct order
// v1 v2 v defines one lateral triangle in the correct order
// v1 w v3 defines the other lateral triangle in the correct order
// w v v2 v3 defines the quad in the correct order
- BOP_addFace(mesh, faces, new BOP_Face3(v1, v, w, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
- BOP_addFace(mesh, faces, new BOP_Face3(v1, v2, v, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
- BOP_addFace(mesh, faces, new BOP_Face3(v1, w, v3, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
+ BOP_addFace(mesh, faces, face1, face->getTAG());
+ BOP_addFace(mesh, faces, face2, face->getTAG());
+ BOP_addFace(mesh, faces, face3, face->getTAG());
+
+ face1->setSplit(face->getSplit());
+ face2->setSplit(face->getSplit());
+ face3->setSplit(face->getSplit());
BOP_Face *faces45[2];
BOP_splitQuad(mesh, face->getPlane(), v2, v3, w, v, faces45, face->getOriginalFace());
BOP_addFace(mesh, faces, faces45[0], face->getTAG());
BOP_addFace(mesh, faces, faces45[1], face->getTAG());
+ faces45[0]->setSplit(face->getSplit());
+ faces45[1]->setSplit(face->getSplit());
face->setTAG(BROKEN);
+ face->freeBBox();
}
@@ -254,15 +268,19 @@ void BOP_triangulateD_split(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face,
{
BOP_Index v = BOP_getNearestVertex(mesh, v1, v4, v5);
BOP_Index w = (v == v4 ? v5 : v4);
+ BOP_Face *face1 = new BOP_Face3(v1, v, v3, face->getPlane(), face->getOriginalFace());
+ BOP_Face *face2 = new BOP_Face3(v, w, v3, face->getPlane(), face->getOriginalFace());
+ BOP_Face *face3 = new BOP_Face3(w, v2, v3, face->getPlane(), face->getOriginalFace());
- BOP_addFace(mesh, faces, new BOP_Face3(v1, v, v3, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
- BOP_addFace(mesh, faces, new BOP_Face3(v, w, v3, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
- BOP_addFace(mesh, faces, new BOP_Face3(w, v2, v3, face->getPlane(),
- face->getOriginalFace()), face->getTAG());
-
+ BOP_addFace(mesh, faces, face1, face->getTAG());
+ BOP_addFace(mesh, faces, face2, face->getTAG());
+ BOP_addFace(mesh, faces, face3, face->getTAG());
+ face1->setSplit(face->getSplit());
+ face2->setSplit(face->getSplit());
+ face3->setSplit(face->getSplit());
+
face->setTAG(BROKEN);
+ face->freeBBox();
}
@@ -328,7 +346,11 @@ void BOP_triangulateE(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face,
BOP_addFace(mesh, faces, face1, face->getTAG());
BOP_addFace(mesh, faces, faces23[0], face->getTAG());
BOP_addFace(mesh, faces, faces23[1], face->getTAG());
+ face1->setSplit(face->getSplit());
+ faces23[0]->setSplit(face->getSplit());
+ faces23[1]->setSplit(face->getSplit());
face->setTAG(BROKEN);
+ face->freeBBox();
}
/**
@@ -380,8 +402,13 @@ void BOP_triangulateF(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face,
BOP_addFace(mesh, faces, faces12[1], face->getTAG());
BOP_addFace(mesh, faces, faces34[0], face->getTAG());
BOP_addFace(mesh, faces, faces34[1], face->getTAG());
+ faces12[0]->setSplit(face->getSplit());
+ faces12[1]->setSplit(face->getSplit());
+ faces34[0]->setSplit(face->getSplit());
+ faces34[1]->setSplit(face->getSplit());
face->setTAG(BROKEN);
+ face->freeBBox();
}
/**
diff --git a/intern/bsp/intern/BSP_CSGMesh_CFIterator.h b/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
index 6863bf38cfc..010f62159a5 100755..100644
--- a/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
+++ b/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
@@ -125,7 +125,8 @@ BSP_CSGMeshVertexIt_Construct(
BSP_CSGMesh_VertexIt * v_it = new BSP_CSGMesh_VertexIt;
v_it->mesh = mesh;
- v_it->pos = &mesh->VertexSet()[0];
+ if( output->num_elements > 0 )
+ v_it->pos = &mesh->VertexSet()[0];
output->it = v_it;
};
@@ -257,11 +258,11 @@ BSP_CSGMesh_FaceIt_Construct(
BSP_CSGMesh_FaceIt * f_it = new BSP_CSGMesh_FaceIt;
f_it->mesh = mesh;
- f_it->pos = &mesh->FaceSet()[0];
+ if( output->num_elements > 0 )
+ f_it->pos = &mesh->FaceSet()[0];
f_it->face_triangle = 0;
output->it = f_it;
-
};
diff --git a/intern/csg/SConscript b/intern/csg/SConscript
deleted file mode 100644
index 84d718e5b67..00000000000
--- a/intern/csg/SConscript
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-Import('env')
-
-sources = env.Glob('intern/*.cpp') + env.Glob('intern/*.inl')
-
-incs = 'intern ../container ../moto/include ../memutil intern/blender extern'
-
-env.BlenderLib ('blender_BSP', sources, Split(incs) , [], libtype='blender', priority=15)
diff --git a/intern/csg/extern/CSG_Interface.h b/intern/csg/extern/CSG_Interface.h
deleted file mode 100644
index 44b01c6f500..00000000000
--- a/intern/csg/extern/CSG_Interface.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef CSG_BOOLEANOPS_H
-#define CSG_BOOLEANOPS_H
-
-
-/**
- * @section Interface structures for CSG module.
- * This interface falls into 2 categories.
- * The first section deals with an abstract mesh description
- * between blender and this module. The second deals with
- * the module functions.
- * The CSG module needs to know about the following entities:
- */
-
-/**
- * CSG_IFace -- an interface polygon structure.
- * vertex_index is a fixed size array of 4 elements containing indices into
- * an abstract vertex container. 3 or 4 of these elements may be used to
- * describe either quads or triangles.
- * vertex_number is the number of vertices in this face - either 3 or 4.
- * vertex_colors is an array of {r,g,b} triplets one for each vertex index.
- * tex_coords is an array of {u,v} triplets one for each vertex index.
- * user_data is a pointer to arbitary data of fixed width ,
- * this data is copied around with the face, and duplicated if a face is
- * split. Contains things like material index.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if 0
-typedef struct {
- int vertex_index[4];
- int vertex_number;
-
- void *user_face_vertex_data[4];
- void *user_face_data;
-} CSG_IFace;
-#else
-
-/**
- * The following structs are much better to use than the crazy
- * abstract type above. It's a value type an allows the CSG
- * module to directly access mesh properties which is very useful
- * for debugging etc.
- */
-
-typedef struct
-{
- int m_vertexIndex;
- float m_uv[2];
- float m_color[4];
- short m_normal[3];
-} CSG_IFaceVertexData;
-
-typedef struct
-{
- struct Material *m_material;
-
- /* assorted tface flags */
- void *m_tpage;
- char m_flag, m_transp;
- short m_mode, m_tile;
-} CSG_IFaceData;
-
-typedef struct
-{
- CSG_IFaceVertexData m_vertexData[4];
- int m_vertexNumber;
-
- CSG_IFaceData m_faceData;
-
-} CSG_IFace;
-
-#endif
-
-/**
- * CSG_IVertex -- an interface vertex structure.
- * position is the location of the vertex in 3d space.
- */
-
-typedef struct {
- float position[3];
-} CSG_IVertex;
-
-
-/**
- * @section Iterator abstraction.
- *
- * The CSG module asks blender to fill in an instance of the above
- * structure, and requests blender to move up and down (iterate) through
- * it's face and vertex containers.
- *
- * An iterator supports the following functions.
- * int IsDone(iterator *it) -- returns true if the iterator has reached
- * the end of it's container.
- *
- * void Fill(iterator *it,DataType *data) -- Return the contents of the
- * container at the current iterator position.
- *
- * void Step(iterator *it) -- increment the iterator to the next position
- * in the container.
- *
- * The iterator is used in the following manner.
- *
- * MyIterator * iterator = ...
- * DataType data;
- *
- * while (!IsDone(iterator)) {
- * Fill(iterator,&data);
- * //process information pointed to by data
- * ...
- * Step(iterator);
- * }
- *
- * The CSG module does not want to know about the implementation of these
- * functions so we use the c function ptr mechanism to hide them. Our
- * iterator descriptor now looks like this.
- */
-
-typedef void* CSG_IteratorPtr;
-
-typedef int (*CSG_FaceItDoneFunc)(CSG_IteratorPtr it);
-typedef void (*CSG_FaceItFillFunc)(CSG_IteratorPtr it,CSG_IFace *face);
-typedef void (*CSG_FaceItStepFunc)(CSG_IteratorPtr it);
-typedef void (*CSG_FaceItResetFunc)(CSG_IteratorPtr it);
-
-typedef struct CSG_FaceIteratorDescriptor {
- CSG_IteratorPtr it;
- CSG_FaceItDoneFunc Done;
- CSG_FaceItFillFunc Fill;
- CSG_FaceItStepFunc Step;
- CSG_FaceItResetFunc Reset;
- unsigned int num_elements;
-} CSG_FaceIteratorDescriptor;
-
-/**
- * Similarly to walk through the vertex arrays we have.
- */
-typedef int (*CSG_VertexItDoneFunc)(CSG_IteratorPtr it);
-typedef void (*CSG_VertexItFillFunc)(CSG_IteratorPtr it,CSG_IVertex *face);
-typedef void (*CSG_VertexItStepFunc)(CSG_IteratorPtr it);
-typedef void (*CSG_VertexItResetFunc)(CSG_IteratorPtr it);
-
-typedef struct CSG_VertexIteratorDescriptor {
- CSG_IteratorPtr it;
- CSG_VertexItDoneFunc Done;
- CSG_VertexItFillFunc Fill;
- CSG_VertexItStepFunc Step;
- CSG_VertexItResetFunc Reset;
- unsigned int num_elements;
-} CSG_VertexIteratorDescriptor;
-
-/**
- * The actual iterator structures are not exposed to the CSG module, they
- * will contain datatypes specific to blender.
- */
-
-/**
- * @section CSG Module interface functions.
- *
- * The functions below are to be used in the following way:
- *
- * // Create a boolean operation handle
- * CSG_BooleanOperation *operation = CSG_NewBooleanFunction();
- * if (operation == NULL) {
- * // deal with low memory exception
- * }
- *
- * // Describe each mesh operand to the module.
- * // NOTE: example properties!
- * CSG_MeshPropertyDescriptor propA,propB;
- * propA.user_data_size = 0;
- * propA.user_face_vertex_data = 0;
- * propB.user_face_vertex_data = 0;
- * propB.user_data_size = 0;
- *
- * // Get the output properties of the mesh.
- * CSG_MeshPropertyDescriptor output_properties;
- * output_properties = CSG_DescibeOperands(
- * operation,
- * propA,
- * propB
- * );
- *
- * // Report to the user if they will loose any data!
- * ...
- *
- * // Get some mesh iterators for your mesh data structures
- * CSG_FaceIteratorDescriptor obA_faces = ...
- * CSG_VertexIteratorDescriptor obA_verts = ...
- *
- * // same for object B
- * CSG_FaceIteratorDescriptor obB_faces = ...
- * CSG_VertexIteratorDescriptor obB_verts = ...
- *
- * // perform the operation...!
- *
- * int success = CSG_PerformBooleanOperation(
- * operation,
- * e_csg_intersection,
- * obA_faces,
- * obA_vertices,
- * obB_faces,
- * obB_vertices
- * );
- *
- * // if the operation failes report miserable faiulre to user
- * // and clear up data structures.
- * if (!success) {
- * ...
- * CSG_FreeBooleanOperation(operation);
- * return;
- * }
- *
- * // read the new mesh vertices back from the module
- * // and assign to your own mesh structure.
- *
- * // First we need to create a CSG_IVertex so the module can fill it in.
- * CSG_IVertex vertex;
- * CSG_VertexIteratorDescriptor * verts_it = CSG_OutputVertexDescriptor(operation);
- *
- * // initialize your vertex container with the number of verts (verts_it->num_elements)
- *
- * while (!verts_it->Done(verts_it->it)) {
- * verts_it->Fill(verts_it->it,&vertex);
- *
- * // create a new vertex of your own type and add it
- * // to your mesh structure.
- * verts_it->Step(verts_it->it);
- * }
- * // Free the vertex iterator
- * CSG_FreeVertexDescriptor(verts_it);
- *
- * // similarly for faces.
- * CSG_IFace face;
- *
- * // you may need to reserve some memory in face->user_data here.
- *
- * // initialize your face container with the number of faces (faces_it->num_elements)
- *
- * CSG_FaceIteratorDescriptor * faces_it = CSG_OutputFaceDescriptor(operation);
- *
- * while (!faces_it->Done(faces_it->it)) {
- * faces_it->Fill(faces_it->it,&face);
- *
- * // create a new face of your own type and add it
- * // to your mesh structure.
- * faces_it->Step(&faces_it->it);
- * }
- *
- * // Free the face iterator
- * CSG_FreeVertexDescriptor(faces_it);
- *
- * // that's it free the operation.
- *
- * CSG_FreeBooleanOperation(operation);
- * return;
- *
- */
-
-/**
- * Description of boolean operation type.
- */
-
-typedef enum {
- e_csg_union,
- e_csg_intersection,
- e_csg_difference,
- e_csg_classify
-} CSG_OperationType;
-
-/**
- * 'Handle' into the CSG module that identifies a particular CSG operation.
- * the pointer CSG_info containers module specific data, and should not
- * be touched in anyway outside of the module.
- */
-
-typedef struct {
- void *CSG_info;
-} CSG_BooleanOperation;
-
-/**
- * Return a ptr to a CSG_BooleanOperation object allocated
- * on the heap. The CSG module owns the memory associated with
- * the returned ptr, use CSG_FreeBooleanOperation() to free this memory.
- */
- CSG_BooleanOperation *
-CSG_NewBooleanFunction(
- void
-);
-
-/**
- * The user data is handled by the BSP modules through
- * the following function which is called whenever the
- * module needs new face vertex properties (when a face is split).
- * d1,d2 are pointers to existing vertex face data. dnew is
- * a pointer to an allocated but unfilled area of user data of
- * size user_face_vertex_data_size in the CSG_MeshPropertyDescriptor
- * returned by a call to the above function. Epsilon is the relative
- * distance (between [0,1]) of the new vertex and the vertex associated
- * with d1. Use epsilon to interpolate the face vertex data in d1 and d2
- * and fill dnew
- */
-
-typedef int (*CSG_InterpolateUserFaceVertexDataFunc)(
- const CSG_IFaceVertexData *d1,
- const CSG_IFaceVertexData * d2,
- CSG_IFaceVertexData *dnew,
- double epsilon
-);
-
-
-/**
- * Attempt to perform a boolean operation between the 2 objects of the
- * desired type. This may fail due to an internal error or lack of memory.
- * In this case 0 is returned, otehrwise 1 is returned indicating success.
- * @param operation is a 'handle' into the CSG_Module created by CSG_NewBooleanFunction()
- * @param op_type is the operation to perform.
- * @param obAFaces is an iterator over the faces of objectA,
- * @param obAVertices is an iterator over the vertices of objectA
- * @param obAFaces is an iterator over the faces of objectB,
- * @param obAVertices is an iterator over the vertices of objectB
- * @param interp_func the face_vertex data interpolation function.(see above)
- *
- * All iterators must be valid and pointing to the first element in their
- * respective containers.
- */
- int
-CSG_PerformBooleanOperation(
- CSG_BooleanOperation * operation,
- CSG_OperationType op_type,
- CSG_FaceIteratorDescriptor obAFaces,
- CSG_VertexIteratorDescriptor obAVertices,
- CSG_FaceIteratorDescriptor obBFaces,
- CSG_VertexIteratorDescriptor obBVertices,
- CSG_InterpolateUserFaceVertexDataFunc interp_func
-);
-
-/**
- * If the a boolean operation was successful, you may access the results
- * through the following functions.
- *
- * CSG_OuputFaceDescriptor() returns a ptr to a CSG_FaceIteratorDesciptor
- * allocated on the heap and owned by the CSG module. The iterator is
- * positioned at the start of the internal face container.
- * CSG_OutputVertexDescriptor() returns a ptr to a CSG_VertexIteratorDescriptor
- * allocated on the heap and owned by the CSG module. The iterator is
- * positioned at the start of the internal vertex container.
- * There is no function to rewind an iterator but you may obtain more
- * than one
- * iterator at a time. Please use the function CSG_FreeFaceIterator()
- * and CSG_FreeVertexIterator to free internal memory allocated for these
- * iterators.
- *
- * If the last operation was not successful, these functions return NULL.
- */
- int
-CSG_OutputFaceDescriptor(
- CSG_BooleanOperation * operation,
- CSG_FaceIteratorDescriptor * output
-);
-
- int
-CSG_OutputVertexDescriptor(
- CSG_BooleanOperation * operation,
- CSG_VertexIteratorDescriptor *output
-);
-
-/**
- * Clean up functions.
- * Free internal memory associated with CSG interface structures. You must
- * call these functions on any structures created by the module, even if
- * subsequent operations did not succeed.
- */
- void
-CSG_FreeVertexDescriptor(
- CSG_VertexIteratorDescriptor * v_descriptor
-);
-
- void
-CSG_FreeFaceDescriptor(
- CSG_FaceIteratorDescriptor * f_descriptor
-);
-
-/**
- * Free the memory associated with a boolean operation.
- * NOTE any iterator descriptor describing the output will become
- * invalid after this call and should be freed immediately.
- */
- void
-CSG_FreeBooleanOperation(
- CSG_BooleanOperation *operation
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif
-
diff --git a/intern/csg/intern/CSG_BBox.h b/intern/csg/intern/CSG_BBox.h
deleted file mode 100644
index 4d17b935a80..00000000000
--- a/intern/csg/intern/CSG_BBox.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-The following BBox class is a lightly modfied version of what
-is found in Free Solid 2.0
-*/
-
-/*
- SOLID - Software Library for Interference Detection
- Copyright (C) 1997-1998 Gino van den Bergen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to gino@win.tue.nl,
- or write to:
- Gino van den Bergen
- Department of Mathematics and Computing Science
- Eindhoven University of Technology
- P.O. Box 513, 5600 MB Eindhoven, The Netherlands
-*/
-
-#ifndef _BBOX_H_
-#define _BBOX_H_
-
-#include "MT_Point3.h"
-#include "MT_Vector3.h"
-#include "MT_MinMax.h"
-
-class BBox {
-public:
- BBox() {}
-
- BBox(
- const MT_Point3& mini,
- const MT_Point3& maxi
- ) { SetValue(mini,maxi); }
-
- const MT_Point3&
- Center(
- ) const {
- return m_center;
- }
-
- const MT_Vector3&
- Extent(
- ) const {
- return m_extent;
- }
-
- MT_Point3&
- Center(
- ) {
- return m_center;
- }
-
- MT_Vector3&
- Extent(
- ) {
- return m_extent;
- }
-
- void
- SetValue(
- const MT_Point3& mini,
- const MT_Point3& maxi
- ) {
- m_extent = (maxi-mini)/2;
- m_center = mini+m_extent;
- }
-
- void
- Enclose(
- const BBox& a,
- const BBox& b
- ) {
- MT_Point3 lower(
- MT_min(a.Lower(0), b.Lower(0)),
- MT_min(a.Lower(1), b.Lower(1)),
- MT_min(a.Lower(2), b.Lower(2))
- );
- MT_Point3 upper(
- MT_max(a.Upper(0), b.Upper(0)),
- MT_max(a.Upper(1), b.Upper(1)),
- MT_max(a.Upper(2), b.Upper(2))
- );
- SetValue(lower, upper);
- }
-
- void
- SetEmpty() {
- m_center.setValue(0, 0, 0);
- m_extent.setValue(-MT_INFINITY,-MT_INFINITY,-MT_INFINITY);
- }
-
- void
- Include (
- const MT_Point3& p
- ) {
- MT_Point3 lower(
- MT_min(Lower(0), p[0]),
- MT_min(Lower(1), p[1]),
- MT_min(Lower(2), p[2])
- );
- MT_Point3 upper(
- MT_max(Upper(0), p[0]),
- MT_max(Upper(1), p[1]),
- MT_max(Upper(2), p[2])
- );
- SetValue(lower, upper);
- }
-
- void
- Include (
- const BBox& b
- ) {
- Enclose(*this, b);
- }
-
- MT_Scalar
- Lower(
- int i
- ) const {
- return m_center[i] - m_extent[i];
- }
- MT_Scalar
- Upper(
- int i
- ) const {
- return m_center[i] + m_extent[i];
- }
-
- MT_Point3
- Lower(
- ) const {
- return m_center - m_extent;
- }
- MT_Point3
- Upper(
- ) const {
- return m_center + m_extent;
- }
-
- MT_Scalar
- Size(
- ) const {
- return MT_max(MT_max(m_extent[0], m_extent[1]), m_extent[2]);
- }
-
- int
- LongestAxis(
- ) const {
- return m_extent.closestAxis();
- }
-
- bool
- IntersectXRay(
- const MT_Point3& xBase
- ) const {
- if (xBase[0] <= Upper(0))
- {
- if (xBase[1] <= Upper(1) && xBase[1] >= Lower(1))
- {
- if (xBase[2] <= Upper(2) && xBase[2] >= Lower(2))
- {
- return true;
- }
- }
- }
- return false;
- }
-
-
-
-
- friend bool intersect(const BBox& a, const BBox& b);
-
-private:
- MT_Point3 m_center;
- MT_Vector3 m_extent;
-};
-
-inline
- bool
-intersect(
- const BBox& a,
- const BBox& b
-) {
- return
- MT_abs(a.m_center[0] - b.m_center[0]) <= a.m_extent[0] + b.m_extent[0] &&
- MT_abs(a.m_center[1] - b.m_center[1]) <= a.m_extent[1] + b.m_extent[1] &&
- MT_abs(a.m_center[2] - b.m_center[2]) <= a.m_extent[2] + b.m_extent[2];
-}
-
-#endif
-
-
diff --git a/intern/csg/intern/CSG_BBoxTree.cpp b/intern/csg/intern/CSG_BBoxTree.cpp
deleted file mode 100644
index 503c3e7f2d4..00000000000
--- a/intern/csg/intern/CSG_BBoxTree.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- SOLID - Software Library for Interference Detection
- Copyright (C) 1997-1998 Gino van den Bergen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to gino@win.tue.nl,
- or write to:
- Gino van den Bergen
- Department of Mathematics and Computing Science
- Eindhoven University of Technology
- P.O. Box 513, 5600 MB Eindhoven, The Netherlands
-*/
-
-#include "CSG_BBoxTree.h"
-#include <algorithm>
-
-
-using namespace std;
-
-
-BBoxInternal::
-BBoxInternal(
- int n, LeafPtr leafIt
-)
-{
- m_tag = INTERNAL;
- m_bbox.SetEmpty();
-
- int i;
- for (i=0;i<n;i++) {
- m_bbox.Include(leafIt[i].m_bbox);
- }
-}
-// Construct a BBoxInternal from a list of BBoxLeaf nodes.
-// Recursive function that does the longest axis median point
-// fit.
-
-void BBoxTree::
-BuildTree(
- LeafPtr leaves, int numLeaves
-) {
- m_branch = 0;
- m_leaves = leaves;
- m_numLeaves = numLeaves;
- m_internals = new BBoxInternal[numLeaves];
-
- RecursiveTreeBuild(m_numLeaves,m_leaves);
-}
-
- void
-BBoxTree::
-RecursiveTreeBuild(
- int n, LeafPtr leafIt
-){
- m_internals[m_branch] = BBoxInternal(n,leafIt);
- BBoxInternal& aBBox = m_internals[m_branch];
-
- m_branch++;
-
- int axis = aBBox.m_bbox.LongestAxis();
- int i = 0, mid = n;
-
- // split the leaves into two groups those that are < bbox.getCenter()[axis]
- // and those that are >=
- // smart bit about this code is it does the grouping in place.
- while (i < mid)
- {
- if (leafIt[i].m_bbox.Center()[axis] < aBBox.m_bbox.Center()[axis])
- {
- ++i;
- } else {
- --mid;
- swap(leafIt[i], leafIt[mid]);
- }
- }
-
- // all of the nodes were on one side of the box center
- // I'm not sure if this case ever gets reached?
- if (mid == 0 || mid == n)
- {
- mid = n / 2;
- }
-
- if (mid >= 2)
- {
- aBBox.rson = m_internals + m_branch;
- RecursiveTreeBuild(mid,leafIt);
- } else {
- aBBox.rson = leafIt;
- }
- if (n - mid >= 2) {
- aBBox.lson = m_internals + m_branch;
- RecursiveTreeBuild(n - mid, leafIt + mid);
- } else {
- aBBox.lson = leafIt + mid;
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_BBoxTree.h b/intern/csg/intern/CSG_BBoxTree.h
deleted file mode 100644
index a9013ccf329..00000000000
--- a/intern/csg/intern/CSG_BBoxTree.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * I've modified some very nice bounding box tree code from
- * Gino van der Bergen's Free Solid Library below. It's basically
- * the same code - but I've hacked out the transformation stuff as
- * I didn't understand it. I've also made it far less elegant!
- *
- */
-
-/*
- SOLID - Software Library for Interference Detection
- Copyright (C) 1997-1998 Gino van den Bergen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to gino@win.tue.nl,
- or write to:
- Gino van den Bergen
- Department of Mathematics and Computing Science
- Eindhoven University of Technology
- P.O. Box 513, 5600 MB Eindhoven, The Netherlands
-*/
-
-#ifndef _BBOXTREE_H_
-#define _BBOXTREE_H_
-
-#include "CSG_BBox.h"
-#include "MT_Line3.h"
-#include "CSG_IndexDefs.h"
-
-#include <vector>
-
-/**
- * Tree structure
- */
-
-class BBoxNode
-{
-public:
- enum TagType { LEAF, INTERNAL };
-
- BBox m_bbox;
- TagType m_tag;
-};
-
-
-class BBoxLeaf : public BBoxNode
-{
-public:
- int m_polyIndex;
-
- BBoxLeaf() {}
-
- BBoxLeaf(int polyIndex, const BBox& bbox)
- : m_polyIndex(polyIndex)
- {
- m_bbox = bbox;
- m_tag = LEAF;
- }
-
-};
-
-
-typedef BBoxLeaf* LeafPtr;
-typedef BBoxNode* NodePtr;
-
-
-class BBoxInternal : public BBoxNode
-{
-public:
- NodePtr lson;
- NodePtr rson;
-
- BBoxInternal() {}
- BBoxInternal(
- int n, LeafPtr leafIt
- );
-
-};
-
-typedef BBoxInternal* InternalPtr;
-
-
-class BBoxTree
-{
-public :
- BBoxTree() {};
-
- const NodePtr RootNode() const {
- return m_internals;
- }
-
- ~BBoxTree() {
- delete[] m_leaves;
- delete[] m_internals;
- }
-
- // tree takes ownership of the leaves.
- void BuildTree(LeafPtr leaves, int numLeaves);
-
-private :
-
- void RecursiveTreeBuild(
- int n, LeafPtr leafIt
- );
-
- int m_branch;
-
- LeafPtr m_leaves;
- InternalPtr m_internals;
- int m_numLeaves;
-};
-
-
-
-
-
-#endif
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_BlenderVProp.h b/intern/csg/intern/CSG_BlenderVProp.h
deleted file mode 100644
index 72cad752c31..00000000000
--- a/intern/csg/intern/CSG_BlenderVProp.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef CSG_BlenderVProp_H
-#define CSG_BlenderVProp_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-// A vertex property that stores a CSG_IFaceVertexData structure defined
-// in the interface between the CSG module and blender CSG_Interface.h!
-
-#include "CSG_Interface.h"
-#include "MT_Scalar.h"
-
-class BlenderVProp
-{
-public :
- // You must set the interpolation function ptr
- // before using this class.
-
- static CSG_InterpolateUserFaceVertexDataFunc InterpFunc;
-
-private :
-
- CSG_IFaceVertexData m_data;
-
-public :
-
- BlenderVProp(const int& vIndex)
- {
- m_data.m_vertexIndex = vIndex;
- }
-
- BlenderVProp(
- const int& vIndex,
- const BlenderVProp& p1,
- const BlenderVProp& p2,
- const MT_Scalar& epsilon
- ){
- m_data.m_vertexIndex = vIndex;
- InterpFunc(&(p1.m_data),&(p2.m_data),&m_data,epsilon);
- }
-
-
- BlenderVProp(
- ) {};
-
- // Default copy constructor and assignment operator are fine.
-
- // Support conversion to an integer
- ///////////////////////////////////
- operator int(
- ) const {
- return m_data.m_vertexIndex;
- }
-
- // and assignment from an integer.
- //////////////////////////////////
- BlenderVProp&
- operator = (
- int i
- ) {
- m_data.m_vertexIndex = i;
- return *this;
- }
-
- // return a reference to our data
- const CSG_IFaceVertexData& Data() const {
- return m_data;
- }
-
- CSG_IFaceVertexData& Data() {
- return m_data;
- }
-
-
-};
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/CSG_BooleanOp.h b/intern/csg/intern/CSG_BooleanOp.h
deleted file mode 100644
index ff293799286..00000000000
--- a/intern/csg/intern/CSG_BooleanOp.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef CSG_BOOLEANOP_H
-#define CSG_BOOLEANOP_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_IndexDefs.h"
-#include "CSG_BBoxTree.h"
-
-template <typename CMesh, typename TMesh> class BooleanOp
-{
-public :
-
- // unimplemented
- ////////////////
- BooleanOp();
- BooleanOp(const BooleanOp&);
- BooleanOp& operator = (const BooleanOp&);
-
- //helpers
- /////////
-
- static
- void
- BuildSplitGroup(
- const TMesh& meshA,
- const TMesh& meshB,
- const BBoxTree& treeA,
- const BBoxTree& treeB,
- OverlapTable& aOverlapsB,
- OverlapTable& bOverlapsA
- );
-
- // Split mesh with mesh2, table is an OverlapTable containing the polygons
- // of mesh2 that intersect with polygons of mesh.
- // if preserve is true this function will aim to reduce the number of
- // T-junctions created.
-
- static
- void
- PartitionMesh(
- CMesh & mesh,
- const TMesh & mesh2,
- const OverlapTable& table
- );
-
- // Classify meshB with respect to meshA, uses a BBox tree of meshA
- // to drastically improve speed!
- static
- void
- ClassifyMesh(
- const TMesh& meshA,
- const BBoxTree& aTree,
- CMesh& meshB
- );
-
- static
- void
- ExtractClassification(
- CMesh& meshA,
- TMesh& newMesh,
- int classification,
- bool reverse
- );
-
-
-};
-
-#include "CSG_BooleanOp.inl"
-
-#endif
diff --git a/intern/csg/intern/CSG_BooleanOp.inl b/intern/csg/intern/CSG_BooleanOp.inl
deleted file mode 100644
index 9309d4ffbb5..00000000000
--- a/intern/csg/intern/CSG_BooleanOp.inl
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#include "CSG_Math.h"
-#include "CSG_BBoxTree.h"
-#include "CSG_TreeQueries.h"
-
-using namespace std;
-
-template <typename CMesh, typename TMesh>
- void
-BooleanOp<CMesh,TMesh>::
-BuildSplitGroup(
- const TMesh& meshA,
- const TMesh& meshB,
- const BBoxTree& treeA,
- const BBoxTree& treeB,
- OverlapTable& aOverlapsB,
- OverlapTable& bOverlapsA
-) {
-
- aOverlapsB = OverlapTable(meshB.Polys().size());
- bOverlapsA = OverlapTable(meshA.Polys().size());
-
- // iterate through the polygons of A and then B
- // and mark each
- TreeIntersector<TMesh>(treeA,treeB,&aOverlapsB,&bOverlapsA,&meshA,&meshB);
-
-}
-
-template <typename CMesh, typename TMesh>
- void
-BooleanOp<CMesh,TMesh>::
-PartitionMesh(
- CMesh & mesh,
- const TMesh & mesh2,
- const OverlapTable& table
-) {
-
- // iterate through the overlap table.
- int i;
-
- MT_Scalar onEpsilon(1e-4);
-
- for (i = 0; i < table.size(); i++)
- {
- if (table[i].size())
- {
- // current list of fragments - initially contains
- // just the to-be-split polygon index
- PIndexList fragments;
- fragments.push_back(i);
-
- // iterate through the splitting polygons.
- int j;
- for (j =0 ; j <table[i].size(); ++j)
- {
- PIndexList newFragments;
-
- // find the splitting plane
- MT_Plane3 splitPlane = mesh2.Polys()[table[i][j]].Plane();
-
- // iterate through the current fragments and split them
- // with the new plane, adding the resulting fragments to
- // the newFragments list.
- int k;
- for (k = 0; k < fragments.size(); ++k)
- {
- int newInFragment;
- int newOutFragment;
-
- CMesh::TGBinder pg1(mesh,fragments[k]);
- TMesh::TGBinder pg2(mesh2,table[i][j]);
-
- const MT_Plane3& fragPlane = mesh.Polys()[fragments[k]].Plane();
-
- if (CSG_PolygonIntersector<CMesh::TGBinder,TMesh::TGBinder >::
- IntersectPolygons(pg1,pg2,fragPlane,splitPlane))
- {
- mesh.SplitPolygon(fragments[k],splitPlane,newInFragment,newOutFragment,onEpsilon);
-
- if (-1 != newInFragment) newFragments.push_back(newInFragment);
- if (-1 != newOutFragment) newFragments.push_back(newOutFragment);
- } else {
- // this fragment was not split by this polygon but it may be split by a subsequent
- // polygon in the list
- newFragments.push_back(fragments[k]);
- }
-
- }
-
- fragments = newFragments;
- }
- }
- }
-}
-
-template <typename CMesh, typename TMesh>
- void
-BooleanOp<CMesh,TMesh>::
-ClassifyMesh(
- const TMesh& meshA,
- const BBoxTree& aTree,
- CMesh& meshB
-) {
-
- // walk through all of the polygons of meshB. Create a
- // ray in the direction of the polygons normal emintaing from the
- // mid point of the polygon
-
- // Do a ray test with all of the polygons of MeshA
- // Find the nearest intersection point and record the polygon index
-
- // If there were no intersections then the ray is outside.
- // If there was an intersection and the dot product of the ray and normal
- // of the intersected polygon from meshA is +ve then we are on the inside
- // else outside.
-
- int i;
- for (i = 0; i < meshB.Polys().size(); i++)
- {
- CMesh::TGBinder pg(meshB,i);
-
- MT_Line3 midPointRay = CSG_Math<CMesh::TGBinder >::PolygonMidPointRay(pg,meshB.Polys()[i].Plane());
-
- MT_Line3 midPointXRay(midPointRay.Origin(),MT_Vector3(1,0,0));
-
- int aPolyIndex(-1);
-
- RayTreeIntersector<TMesh>(aTree,&meshA,midPointXRay,aPolyIndex);
-
- if (-1 != aPolyIndex)
- {
- if (meshA.Polys()[aPolyIndex].Plane().signedDistance(midPointXRay.Origin()) < 0)
- {
- meshB.Polys()[i].Classification()= 1;
- } else {
- meshB.Polys()[i].Classification()= 2;
- }
- } else {
- meshB.Polys()[i].Classification()= 2;
- }
- }
-}
-
-
-template <typename CMesh, typename TMesh>
- void
-BooleanOp<CMesh,TMesh>::
-ExtractClassification(
- CMesh& meshA,
- TMesh& newMesh,
- int classification,
- bool reverse
-){
-
- int i;
- for (i = 0; i < meshA.Polys().size(); ++i)
- {
- CMesh::Polygon& meshAPolygon = meshA.Polys()[i];
- if (meshAPolygon.Classification() == classification)
- {
- newMesh.Polys().push_back(meshAPolygon);
- TMesh::Polygon& newPolygon = newMesh.Polys().back();
-
- if (reverse) newPolygon.Reverse();
-
- // iterate through the vertices of the new polygon
- // and find a new place for them in the new mesh (if they arent already there)
-
- int j;
- for (j=0; j< newPolygon.Size(); j++)
- {
- if (meshA.Verts()[newPolygon[j]].VertexMap() == -1)
- {
- // this is the first time we have visited this vertex
- // copy it over to the new mesh.
- newMesh.Verts().push_back(meshA.Verts()[newPolygon[j]]);
- // and record it's position in the new mesh for the next time we visit it.
- meshA.Verts()[newPolygon[j]].VertexMap() = newMesh.Verts().size() -1;
- }
- newPolygon.VertexProps(j) = meshA.Verts()[newPolygon[j]].VertexMap();
- }
- }
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_CVertex.h b/intern/csg/intern/CSG_CVertex.h
deleted file mode 100644
index fd0a7b098b5..00000000000
--- a/intern/csg/intern/CSG_CVertex.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef CSG_CVertex_H
-#define CSG_CVertex_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include <algorithm>
-#include "CSG_IndexDefs.h"
-#include "CSG_Vertex.h"
-// This class extends an existing vertex by connecting
-// them with their polygons through the PIndexList member.
-//
-// This extra information allows us to perform local
-// mesh topology queries
-//
-// These queries are availble through the ConnectedMesh class.
-
-class CVertex : public VertexBase
-{
-private :
-
- // polygons using this vertex
- PIndexList m_polygons;
-
-public :
-
- CVertex()
- :VertexBase(),m_polygons()
- {
- };
-
- // have to change VertexBase and all functions to
- // use Pos() rather than m_pos;
-
- CVertex(const VertexBase& vertex)
- :VertexBase(vertex),m_polygons()
- {}
-
- // Value type model
- ///////////////////
- CVertex(const CVertex& other)
- : VertexBase(other), m_polygons(other.m_polygons)
- {}
-
- CVertex& operator = (const CVertex& other)
- {
- m_pos = other.Pos();
- m_vertexMap = other.m_vertexMap;
- m_polygons = other.m_polygons;
-
- return *this;
- }
-
-
- CVertex& operator = (const VertexBase& other)
- {
- m_pos= other.Pos();
- return *this;
- }
-
-
- ~CVertex(){};
-
- // Our special connected vertex functions.
- //////////////////////////////////////////
-
- const PIndexList& Polys() const { return m_polygons;}
- PIndexList& Polys() { return m_polygons;}
-
- int & operator[] (const int & i) { return m_polygons[i];}
-
- const int & operator[] (const int& i) const { return m_polygons[i];}
-
- void AddPoly(int polyIndex) {m_polygons.push_back(polyIndex);}
-
- void RemovePolygon(int polyIndex)
- {
- PIndexIt foundIt = std::find(m_polygons.begin(),m_polygons.end(),polyIndex);
- if (foundIt != m_polygons.end()) {
- std::swap(m_polygons.back(), *foundIt);
- m_polygons.pop_back();
- }
- }
-};
-
-
-#endif
diff --git a/intern/csg/intern/CSG_ConnectedMesh.h b/intern/csg/intern/CSG_ConnectedMesh.h
deleted file mode 100644
index 6cf73ef2240..00000000000
--- a/intern/csg/intern/CSG_ConnectedMesh.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef CSG_ConnectedMesh_H
-#define CSG_ConnectedMesh_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_GeometryBinder.h"
-#include "MT_Plane3.h"
-
-template <typename TMesh> class ConnectedMeshWrapper
-{
-public :
-
- typedef TMesh::Polygon Polygon;
- typedef TMesh::Vertex Vertex;
-
- typedef TMesh::Polygon::TVProp VProp;
-
- typedef TMesh::VLIST VLIST;
- typedef TMesh::PLIST PLIST;
-
- typedef PolygonGeometry<ConnectedMeshWrapper> TGBinder;
-
- typedef ConnectedMeshWrapper<TMesh> MyType;
-
-private :
- TMesh& m_mesh;
-
- unsigned int m_uniqueEdgeTestId;
-
-public :
-
- // Mesh Template interface
- //////////////////////////
- VLIST& Verts() {return m_mesh.Verts();}
- const VLIST& Verts() const {return m_mesh.Verts();}
-
- PLIST& Polys() {return m_mesh.Polys();}
- const PLIST& Polys() const {return m_mesh.Polys();}
-
- // Mesh Wrapper functions
- /////////////////////////
-
- ConnectedMeshWrapper(TMesh& mesh):
- m_mesh(mesh),m_uniqueEdgeTestId(0) {};
-
- void BuildVertexPolyLists();
-
- void DisconnectPolygon(int polyIndex);
-
- void ConnectPolygon(int polyIndex);
-
- //return the polygons neibouring the given edge.
- void EdgePolygons(int v1, int v2, PIndexList& polys);
-
- void InsertVertexAlongEdge(int v1,int v2, const VProp& prop);
-
- void
- SplitPolygon(
- const int p1Index,
- const MT_Plane3& plane,
- int& inPiece,
- int& outPiece,
- const MT_Scalar onEpsilon
- );
-
- ~ConnectedMeshWrapper(){};
-};
-
-#include "CSG_ConnectedMeshWrapper.inl"
-
-#endif
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_ConnectedMeshWrapper.inl b/intern/csg/intern/CSG_ConnectedMeshWrapper.inl
deleted file mode 100644
index 5d6cc11cc48..00000000000
--- a/intern/csg/intern/CSG_ConnectedMeshWrapper.inl
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#include <algorithm>
-#include <iterator>
-#include "CSG_SplitFunction.h"
-
-// Define functors things that bind a function to an object,
-// for the templated split polygon code.
-
-template <typename CMesh> class SplitFunctionBindor
-{
-private :
- CMesh& m_mesh;
-
-public :
-
- SplitFunctionBindor(CMesh& mesh):m_mesh(mesh) {};
-
- void DisconnectPolygon(int polyIndex){
- m_mesh.DisconnectPolygon(polyIndex);
- }
-
- void ConnectPolygon(int polygonIndex) {
- m_mesh.ConnectPolygon(polygonIndex);
- }
-
- void InsertVertexAlongEdge(int lastIndex,int newIndex,const CMesh::VProp& prop) {
- m_mesh.InsertVertexAlongEdge(lastIndex,newIndex,prop);
- }
-
- ~SplitFunctionBindor(){};
-};
-
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-BuildVertexPolyLists(
-) {
- int i;
- for (i=0; i < Polys().size(); i++)
- {
- ConnectPolygon(i);
- }
-}
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-DisconnectPolygon(
- int polyIndex
-){
- const Polygon& poly = Polys()[polyIndex];
-
- int j;
- for (j=0;j<poly.Verts().size(); j++)
- {
- Verts()[poly[j]].RemovePolygon(polyIndex);
- }
-}
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-ConnectPolygon(
- int polyIndex
-){
- const Polygon& poly = Polys()[polyIndex];
-
- int j;
- for (j=0;j<poly.Verts().size(); j++)
- {
- Verts()[poly[j]].AddPoly(polyIndex);
- }
-}
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-EdgePolygons(
- int v1,
- int v2,
- PIndexList& polys
-) {
- ++m_uniqueEdgeTestId;
-
- Vertex& vb1 = Verts()[v1];
- int i;
- for (i=0;i < vb1.Polys().size(); ++i)
- {
- Polys()[vb1[i]].Classification() = m_uniqueEdgeTestId;
- }
-
- Vertex& vb2 = Verts()[v2];
- int j;
- for (j=0;j < vb2.Polys().size(); ++j)
- {
- if (Polys()[vb2[j]].Classification() == m_uniqueEdgeTestId)
- {
- polys.push_back(vb2[j]);
- }
- }
-}
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-InsertVertexAlongEdge(
- int v1,
- int v2,
- const VProp& prop
-) {
-
- PIndexList npolys;
- EdgePolygons(v1,v2,npolys);
-
- // iterate through the neighbouting polygons of
- // this edge and insert the vertex into the polygon
-
- int newVertex = int(prop);
-
- int i;
- for (i=0;i < npolys.size(); i++)
- {
- // find the first vertex index in this polygon
- Polygon::TVPropList& polyVerts = Polys()[npolys[i]].Verts();
-
- Polygon::TVPropIt v1pos = std::find(polyVerts.begin(),polyVerts.end(),v1);
-
- // this should never be false!
- if (v1pos != polyVerts.end())
- {
- // v2 must be either side of this pos
- Polygon::TVPropIt prevPos = (v1pos == polyVerts.begin()) ? polyVerts.end()-1 : v1pos-1;
- Polygon::TVPropIt nextPos = (v1pos == polyVerts.end()-1) ? polyVerts.begin() : v1pos+1;
-
- if (*prevPos == v2) {
- polyVerts.insert(v1pos,prop);
- } else
- if (*nextPos == v2) {
- polyVerts.insert(nextPos,prop);
- } else {
- //assert(false);
- }
-
- Verts()[newVertex].AddPoly(npolys[i]);
- } else {
- assert(false);
- }
- }
-}
-
-
-template <typename TMesh>
- void
-ConnectedMeshWrapper<TMesh>::
-SplitPolygon(
- const int p1Index,
- const MT_Plane3& plane,
- int& inPiece,
- int& outPiece,
- const MT_Scalar onEpsilon
-){
-
- SplitFunctionBindor<MyType> functionBindor(*this);
-
- SplitFunction<MyType,SplitFunctionBindor<MyType> > splitFunction(*this,functionBindor);
- splitFunction.SplitPolygon(p1Index,plane,inPiece,outPiece,onEpsilon);
-}
-
-#if 0
-template <class TPolygon, class TVertex>
- void
-Mesh::
-printMesh(
- std::ostream& stream
-) {
-
- int i;
- for (i =0; i < m_polys.size(); i++)
- {
- std::ostream_iterator<int> streamIt(stream," ");
- std::copy(m_polys[i].Verts().begin(),m_polys[i].Verts().end(),streamIt);
- stream << "\n";
- }
-}
-
-#endif
-
-
-
-
diff --git a/intern/csg/intern/CSG_GeometryBinder.h b/intern/csg/intern/CSG_GeometryBinder.h
deleted file mode 100644
index 2977ac65971..00000000000
--- a/intern/csg/intern/CSG_GeometryBinder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef CSG_GEOMETRY_BINDER_H
-#define CSG_GEOMETRY_BINDER_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-// This class binds the geometry of a polygon
-// to the polygon itself it provides just one
-// operator [int i] that returns the vertex position
-// of the ith vertex in the polygon.
-
-// Its a model of a geometry binder primarily used by the CSG_Math
-// template class to compute geometric information about a mesh.
-
-#include "MT_Point3.h"
-
-
-template <typename TMesh> class PolygonGeometry
-{
-public :
-
- typedef typename TMesh::Polygon TPolygon;
-
- PolygonGeometry(const TMesh& mesh, int pIndex)
- : m_poly(mesh.Polys()[pIndex]),m_mesh(mesh)
- {};
-
- PolygonGeometry(const TMesh& mesh,const TPolygon& poly)
- : m_poly(poly),m_mesh(mesh)
- {};
-
- const MT_Point3& operator[] (int i) const {
- return m_mesh.Verts()[m_poly[i]].Pos();
- };
-
- int Size() const { return m_poly.Size();}
-
- ~PolygonGeometry(){};
-
-private :
-
- PolygonGeometry(const PolygonGeometry& other) {};
- PolygonGeometry& operator = (PolygonGeometry& other) { return *this;}
-
- const TMesh& m_mesh;
- const TPolygon& m_poly;
-
-};
-
-#endif
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_IndexDefs.h b/intern/csg/intern/CSG_IndexDefs.h
deleted file mode 100644
index 2e1e05a5eb4..00000000000
--- a/intern/csg/intern/CSG_IndexDefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef CSG_INDEXDEFS_H
-#define CSG_INDEXDEFS_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-//typdefs for lists and things in the CSG library
-
-#include <vector>
-
-typedef std::vector<int> PIndexList;
-typedef PIndexList::iterator PIndexIt;
-typedef PIndexList::const_iterator const_PIndexIt;
-
-typedef std::vector<int> VIndexList;
-typedef VIndexList::iterator VIndexIt;
-typedef VIndexList::const_iterator const_VIndexIt;
-
-typedef std::vector< PIndexList > OverlapTable;
-
-
-
-#endif
-
-
diff --git a/intern/csg/intern/CSG_Math.h b/intern/csg/intern/CSG_Math.h
deleted file mode 100644
index 0c41e3d63ae..00000000000
--- a/intern/csg/intern/CSG_Math.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef __CSG_MATH_H
-#define __CSG_MATH_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "MT_Plane3.h"
-#include "MT_Matrix3x3.h"
-#include "MT_Line3.h"
-#include "CSG_BBox.h"
-
-// useful geometry functions.
-/////////////////////////////
-
-const int cofacTable[3][2] = {{1,2},{0,2},{0,1}};
-
-class CSG_Geometry
-{
-public :
-
- static bool Intersect(
- const MT_Plane3& p1,
- const MT_Plane3& p2,
- MT_Line3& output
- );
-
- // Return intersection of line1 and line 2 in the plane formed by the given
- // standard axis. Intersection l1Param is the intersection parameter of line1.
- static bool Intersect2D(
- const MT_Line3& l1,
- const MT_Line3& l2,
- int majAxis,
- MT_Scalar& l1Param
- );
-
- static bool Intersect2DBoundsCheck(
- const MT_Line3& l1,
- const MT_Line3& l2,
- int majAxis,
- MT_Scalar& l1Param,
- MT_Scalar& l2Param
- );
-
- static bool Intersect2DNoBoundsCheck(
- const MT_Line3& l1,
- const MT_Line3& l2,
- int majAxis,
- MT_Scalar& l1Param,
- MT_Scalar& l2Param
- );
-
- static int ComputeClassification(
- const MT_Scalar& distance,
- const MT_Scalar& epsilon
- );
-};
-
-// The template parameter TGBinder is a model of a Geometry Binder concept
-// see CSG_GeometryBinder.h for an example.
-
-template <typename TGBinder> class CSG_Math
-{
-public :
-
- static bool IntersectPolyWithLine2D(
- const MT_Line3& l,
- const TGBinder& p1,
- const MT_Plane3& plane,
- MT_Scalar& a,
- MT_Scalar& b
- );
-
- static bool InstersectPolyWithLine3D(
- const MT_Line3& l,
- const TGBinder& p1,
- const MT_Plane3& plane,
- MT_Scalar& a
- );
-
- static bool PointInPolygonTest3D(
- const TGBinder& p1,
- const MT_Plane3& plane,
- const MT_Point3& origin,
- const MT_Point3& pointOnPlane
- );
-
- // Return the mid-point of the given polygon index.
- static MT_Point3 PolygonMidPoint(
- const TGBinder& p1
- );
-
- static MT_Line3 PolygonMidPointRay(
- const TGBinder& p1,
- const MT_Plane3& plane
- );
-
- static MT_Plane3 ComputePlane(
- const TGBinder &p1
- );
-
- // Return a bounding box of the given polygon index.
- static BBox FitBBox(
- const TGBinder& p1
- );
-
- // Return which side of the polygon the plane is on.
- // 0 == 0n
- // 1 == in
- // 2 == out
- // 3 == Straddle
- static int WhichSide(
- const TGBinder& p1,
- const MT_Plane3& plane1
- );
-
-};
-
-template <class TGBinderA, class TGBinderB> class CSG_PolygonIntersector
-{
-public :
-
- static bool IntersectPolygons (
- const TGBinderA& p1,
- const TGBinderB& p2,
- const MT_Plane3& plane1,
- const MT_Plane3& plane2
- );
-
-};
-
-
-#include "CSG_Math.inl"
-
-#endif
-
diff --git a/intern/csg/intern/CSG_Math.inl b/intern/csg/intern/CSG_Math.inl
deleted file mode 100644
index 73483ea41d6..00000000000
--- a/intern/csg/intern/CSG_Math.inl
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#include "CSG_Math.h"
-#include "MT_minmax.h"
-#include "MT_Point2.h"
-#include "MT_Vector2.h"
-#include "MT_Plane3.h"
-
-#include <vector>
-
-using namespace std;
-
-inline bool CSG_Geometry::Intersect(
- const MT_Plane3& p1,
- const MT_Plane3& p2,
- MT_Line3& output
-) {
- MT_Matrix3x3 mat;
- mat[0] = p1.Normal();
- mat[1] = p2.Normal();
- mat[2] = mat[0].cross(mat[1]);
-
- if (mat[2].fuzzyZero())
- {
- return false;
- }
-
- MT_Vector3 aPoint(-p1.Scalar(),-p2.Scalar(),0);
-
- output = MT_Line3(MT_Point3(0,0,0) + mat.inverse()*aPoint ,mat[2]);
-
- assert(MT_fuzzyZero(p1.signedDistance(output.Origin())));
- assert(MT_fuzzyZero(p2.signedDistance(output.Origin())));
-
-
- return true;
-}
-
-inline bool CSG_Geometry::Intersect2DNoBoundsCheck(
- const MT_Line3& l1,
- const MT_Line3& l2,
- int majAxis,
- MT_Scalar& l1Param,
- MT_Scalar& l2Param
-){
- int ind1 = cofacTable[majAxis][0];
- int ind2 = cofacTable[majAxis][1];
-
- MT_Scalar Zx = l2.Origin()[ind1] - l1.Origin()[ind1];
- MT_Scalar Zy = l2.Origin()[ind2] - l1.Origin()[ind2];
-
- MT_Scalar det = l1.Direction()[ind1]*l2.Direction()[ind2] -
- l2.Direction()[ind1]*l1.Direction()[ind2];
-
- if (MT_fuzzyZero(det))
- {
- return false;
- }
-
- l1Param = (l2.Direction()[ind2]*Zx - l2.Direction()[ind1]*Zy)/det;
- l2Param = -(-l1.Direction()[ind2]*Zx + l1.Direction()[ind1]*Zy)/det;
-
- return true;
-}
-
-
-inline bool CSG_Geometry::Intersect2DBoundsCheck(
- const MT_Line3& l1,
- const MT_Line3& l2,
- int majAxis,
- MT_Scalar& l1Param,
- MT_Scalar& l2Param
-) {
-
- bool isect = Intersect2DNoBoundsCheck(l1,l2,majAxis,l1Param,l2Param);
- if (!isect) return false;
-
- return l1.IsParameterOnLine(l1Param) && l2.IsParameterOnLine(l2Param);
-}
-
-
-//IMplementation of CSG_Math
-////////////////////////////
-
-template<typename TGBinder>
-inline bool CSG_Math<TGBinder>::IntersectPolyWithLine2D(
- const MT_Line3& l,
- const TGBinder& p1,
- const MT_Plane3& plane,
- MT_Scalar& a,
- MT_Scalar& b
-){
- int majAxis = plane.Normal().closestAxis();
- int lastInd = p1.Size()-1;
-
- b = (-MT_INFINITY);
- a = (MT_INFINITY);
-
- MT_Scalar isectParam(0);
- MT_Scalar isectParam2(0);
-
- int i;
- int j = lastInd;
- int isectsFound(0);
- for (i=0;i<=lastInd; j=i,i++ )
- {
- MT_Line3 testLine(p1[j],p1[i]);
- if ( CSG_Geometry::Intersect2DBoundsCheck(l,testLine,majAxis,isectParam,isectParam2))
- {
- ++isectsFound;
- b = MT_max(isectParam,b);
- a = MT_min(isectParam,a);
- }
- }
-
- return (isectsFound > 0);
-}
-
-template<typename TGBinder>
-inline bool CSG_Math<TGBinder>::InstersectPolyWithLine3D(
- const MT_Line3& l,
- const TGBinder& p1,
- const MT_Plane3& plane,
- MT_Scalar& a
-){
- // First compute intersection parameter t
- MT_Scalar determinant = l.Direction().dot(plane.Normal());
-
- // they are coplanar but we're not interested in that right?
- if (MT_fuzzyZero(determinant)) return false;
-
- a = -plane.Scalar() - plane.Normal().dot(l.Origin());
- a /= determinant;
-
- // intersection point is behind the ray.
- if (a <= 0 ) return false;
-
-
- // check if line is bounded and if t lies in bounds.
- if (!l.IsParameterOnLine(a)) return false;
-
- // calculate the point on the plane
- MT_Point3 pointOnPlane = l.Origin() + l.Direction()*a;
-
- assert(MT_fuzzyZero(plane.signedDistance(pointOnPlane)));
-
- // make sure the intersection point is within the polygon
- return PointInPolygonTest3D(p1,plane,l.Origin(),pointOnPlane);
-}
-
-
-
-template<typename TGBinder>
-inline bool CSG_Math<TGBinder>::PointInPolygonTest3D(
- const TGBinder& p1,
- const MT_Plane3& plane,
- const MT_Point3& origin,
- const MT_Point3& pointOnPlane
-) {
- // Form planes with the edges of the polygon and the origin.
- // make sure that origin is inside all these planes.
-
- // ONe small detail we have to first workout which side the origin
- // is wrt the plane of the polygon.
-
- bool discardSign = plane.signedDistance(origin) < 0 ? true : false;
-
- const int polySize = p1.Size();
-
- MT_Point3 lastPoint = p1[polySize-1];
-
- int i;
- for (i=0;i<polySize; ++i)
- {
- const MT_Point3& aPoint = p1[i];
-
- MT_Plane3 testPlane(origin,lastPoint,aPoint);
- if ((testPlane.signedDistance(pointOnPlane) <= 0) == discardSign)
- {
- return false;
- }
- lastPoint = aPoint;
- }
- return true;
-}
-
-// return 0 = on
-// return 1 = in
-// return 2 = out
-
-inline int CSG_Geometry::ComputeClassification(
- const MT_Scalar& distance,
- const MT_Scalar& epsilon
-) {
- if (MT_abs(distance) < epsilon)
- {
- return 0;
- } else {
- return distance < 0 ? 1 : 2;
- }
-}
-
-// Return the mid-point of the given polygon index.
-template <typename TGBinder>
-inline MT_Point3 CSG_Math<TGBinder>::PolygonMidPoint(
- const TGBinder& p1
-){
-
- MT_Point3 midPoint(0,0,0);
-
- int i;
- for (i=0; i < p1.Size(); i++)
- {
- midPoint += p1[i];
- }
-
- return MT_Point3(midPoint[0]/i,midPoint[1]/i,midPoint[2]/i);
-}
-
-template <typename TGBinder>
-int CSG_Math<TGBinder>::WhichSide(
- const TGBinder& p1,
- const MT_Plane3& plane1
-){
-
- int output = 0;
- int i;
- for (i=0; i<p1.Size(); i++)
- {
- MT_Scalar signedDistance = plane1.signedDistance(p1[i]);
- if (!MT_fuzzyZero(signedDistance))
- {
- signedDistance < 0 ? (output |= 1) : (output |=2);
- }
- }
- return output;
-
-}
-
-
-template <typename TGBinder>
-inline MT_Line3 CSG_Math<TGBinder>::PolygonMidPointRay(
- const TGBinder& p1,
- const MT_Plane3& plane
-){
- return MT_Line3(PolygonMidPoint(p1),plane.Normal(),true,false);
-}
-
-template <typename TGBinder>
-inline MT_Plane3 CSG_Math<TGBinder>::ComputePlane(
- const TGBinder &poly
-){
- assert(poly.Size() >= 3);
- MT_Point3 plast(poly[poly.Size()-1]);
- MT_Point3 pivot;
- MT_Vector3 edge;
- int j;
- for (j=0; j < poly.Size(); j++)
- {
- pivot = poly[j];
- edge = pivot - plast;
- if (!edge.fuzzyZero()) break;
- }
-
- for (; j < poly.Size(); j++)
- {
- MT_Vector3 v2 = poly[j] - pivot;
- MT_Vector3 v3 = edge.cross(v2);
- if (!v3.fuzzyZero())
- {
- return MT_Plane3(v3,pivot);
- }
- }
-
- return MT_Plane3();
-
-}
-
-template <typename TGBinder>
-inline BBox CSG_Math<TGBinder>::FitBBox(
- const TGBinder& p1
-) {
- BBox bbox;
- bbox.SetEmpty();
-
- for (int i = 0; i < p1.Size(); ++i) {
- bbox.Include(p1[i]);
- }
- return bbox;
-}
-
-// we now have enough machinary to intersect 3d polygons
-// Compute line of intersect
-// Intersect line with each edge in PolygonB record min and max intersection parameters
-// Do same for PolygonB. If range of intersections overlap then polys overlap.
-
-// Does not yet deal with 2d case.
-
-template<typename TGBinderA, typename TGBinderB>
-inline bool CSG_PolygonIntersector<TGBinderA,TGBinderB>::IntersectPolygons (
- const TGBinderA& p1,
- const TGBinderB& p2,
- const MT_Plane3& plane1,
- const MT_Plane3& plane2
-){
- MT_Line3 intersectLine;
- if (!CSG_Geometry::Intersect(plane1,plane2,intersectLine))
- {
- // parrallel planes
- return false;
- }
- // check intersection of polygons with intersectLine
- MT_Scalar p1A,p1B;
- MT_Scalar p2A,p2B;
- if (
- !CSG_Math<TGBinderA>::IntersectPolyWithLine2D(intersectLine,p1,plane1,p1A,p1B) ||
- !CSG_Math<TGBinderB>::IntersectPolyWithLine2D(intersectLine,p2,plane2,p2A,p2B)
- ) {
- return false;
- }
-
- // see if intersections overlap.
-
- MT_Scalar maxOMin = MT_max(p1A,p2A);
- MT_Scalar minOMax = MT_min(p1B,p2B);
-
- return (maxOMin <= minOMax);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_Mesh.h b/intern/csg/intern/CSG_Mesh.h
deleted file mode 100644
index bd687824484..00000000000
--- a/intern/csg/intern/CSG_Mesh.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __MESH_H
-#define __MESH_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_GeometryBinder.h"
-#include <vector>
-
-// Simple vertex polygon container class
-//--------------------------------------
-
-template <typename TPolygon, typename TVertex> class Mesh
-{
-public :
- typedef std::vector<TVertex> VLIST;
- typedef std::vector<TPolygon> PLIST;
-
- typedef TPolygon Polygon;
- typedef TVertex Vertex;
-
- typedef PolygonGeometry<Mesh> TGBinder;
-
-private :
-
- VLIST m_verts;
- PLIST m_polys;
-
- MT_Point3 m_bBoxMin;
- MT_Point3 m_bBoxMax;
-
-
-public :
-
- Mesh():
- m_verts(),
- m_polys()
- {};
-
- VLIST& Verts() {return m_verts;}
- const VLIST& Verts() const {return m_verts;}
-
- PLIST& Polys() {return m_polys;}
- const PLIST& Polys() const {return m_polys;}
-
- ~Mesh() {}
-};
-
-#endif
diff --git a/intern/csg/intern/CSG_MeshCopier.h b/intern/csg/intern/CSG_MeshCopier.h
deleted file mode 100644
index 4acf4440df6..00000000000
--- a/intern/csg/intern/CSG_MeshCopier.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef CSG_MeshCopier_H
-#define CSG_MeshCopier_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-
-template <typename MeshA, typename MeshB> class MeshCopier
-{
-public :
-
- static void Copy(const MeshA& source, MeshB& output)
- {
- int vertexNum = source.Verts().size();
- int polyNum = source.Polys().size();
-
- output.Verts() = MeshB::VLIST(vertexNum);
- output.Polys() = MeshB::PLIST(polyNum);
-
- std::copy(source.Verts().begin(),source.Verts().end(),output.Verts().begin());
- std::copy(source.Polys().begin(),source.Polys().end(),output.Polys().begin());
-
- }
-
-};
-
-#endif
-
diff --git a/intern/csg/intern/CSG_MeshWrapper.h b/intern/csg/intern/CSG_MeshWrapper.h
deleted file mode 100644
index b557dde37c9..00000000000
--- a/intern/csg/intern/CSG_MeshWrapper.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef CSG_MESH_WRAPPER_H
-#define CSG_MESH_WRAPPER_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-// This class wraps a mesh providing
-// simple mesh functions required by the CSG library.
-// TMesh is a model of a mesh and as such should have the
-// following public typedefs and functions
-//
-// TMesh::Vertex the vertex type
-// TMesh::Polygon the polygon type.
-// TMesh::VLIST an stl container of Vertex objects
-// TMesh::PLIST an stl container of Polygon objects
-//
-// VLIST& Verts();
-// const VLIST& Verts();
-//
-// PLIST& Polys();
-// const PLIST& Polys();
-
-#include "CSG_GeometryBinder.h"
-#include "MT_Transform.h"
-#include "CSG_BBox.h"
-
-#include <vector>
-
-template <typename TMesh> class MeshWrapper
-{
-public :
-
- typedef TMesh::Polygon Polygon;
- typedef TMesh::Vertex Vertex;
-
- typedef TMesh::VLIST VLIST;
- typedef TMesh::PLIST PLIST;
-
- typedef PolygonGeometry<MeshWrapper> TGBinder;
-
- typedef MeshWrapper<TMesh> MyType;
-
-private :
- TMesh& m_mesh;
-
-public :
-
- // Mesh Template interface
- //////////////////////////
-
- VLIST& Verts() {return m_mesh.Verts();}
- const VLIST& Verts() const {return m_mesh.Verts();}
-
- PLIST& Polys() {return m_mesh.Polys();}
- const PLIST& Polys() const {return m_mesh.Polys();}
-
- // Mesh Wrapper functions
- /////////////////////////
-
- MeshWrapper(TMesh& mesh)
- : m_mesh(mesh)
- {}
-
- void ComputePlanes();
-
- void BurnTransform(const MT_Transform& t);
-
- BBox ComputeBBox() const;
-
- // Triangulate this mesh - does not preserve vertex->polygon information.
- void Triangulate();
-
- // Split the polygon at position p1Index in the mesh mesh1 into 2 pieces.
- // Remove the polygon p1 and add the 2 pieces (along with the 2 new vertices)
- // to the mesh. Returns the index of the 2 new pieces in the mesh.(either of [but never both] which can be
- // -1 if there was nothing to split.
-
- void SplitPolygon(
- const int p1Index,
- const MT_Plane3& plane,
- int& inPiece,
- int& outPiece,
- const MT_Scalar onEpsilon
- );
-
-
- ~MeshWrapper(){};
-
-};
-
-#include "CSG_MeshWrapper.inl"
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/CSG_MeshWrapper.inl b/intern/csg/intern/CSG_MeshWrapper.inl
deleted file mode 100644
index 7a9a141e92a..00000000000
--- a/intern/csg/intern/CSG_MeshWrapper.inl
+++ /dev/null
@@ -1,150 +0,0 @@
-// Implementation of MeshWrapper template class.
-////////////////////////////////////////////////
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#include "CSG_Math.h"
-#include "CSG_Triangulate.h"
-#include "CSG_SplitFunction.h"
-
-template <typename TMesh>
-void MeshWrapper<TMesh>::ComputePlanes()
-{
- PLIST& polyList = Polys();
-
- int i;
- for (i=0;i < polyList.size(); i++)
- {
- TGBinder binder(m_mesh,i);
- polyList[i].SetPlane(CSG_Math<TGBinder>::ComputePlane(binder));
- }
-}
-
-template <typename TMesh>
-void MeshWrapper<TMesh>::BurnTransform(const MT_Transform& t)
-{
- VLIST& vertexList = Verts();
-
- int i;
- for (i=0;i<vertexList.size(); i++)
- {
- vertexList[i].Pos() = t * vertexList[i].Pos();
- }
- ComputePlanes();
-
-}
-
-template <typename TMesh>
-BBox MeshWrapper<TMesh>::ComputeBBox() const
-{
- const VLIST& vertexList = Verts();
-
- BBox bbox;
- bbox.SetEmpty();
-
- int i;
- for (i=0;i<vertexList.size(); i++)
- {
- bbox.Include(vertexList[i].Pos());
- }
- return bbox;
-
-}
-
-
-template <typename TMesh>
-void MeshWrapper<TMesh>::Triangulate()
-{
- vector<Polygon> newPolys;
-
- CSG_Triangulate<TGBinder> triangulator;
- int i;
- for (i=0; i< Polys().size(); ++i)
- {
- TGBinder pg(m_mesh,i);
- const Polygon& poly = Polys()[i];
-
- if (pg.Size() >= 4)
- {
- VIndexList triangleList;
-
- if (triangulator.Process(pg,poly.Plane(),triangleList))
- {
-
- // translate the triangle list into the real vertex properties
- int tSize = triangleList.size();
- Polygon::TVPropList triangleProps(tSize);
-
- int j;
- for (j=0; j < tSize; j++)
- {
- triangleProps[j] = poly.VertexProps(triangleList[j]);
- }
-
- // iterate through the new triangles
- for (j=0; j < tSize; j+=3)
- {
- // copy the polygon
- newPolys.push_back(poly);
- newPolys.back().Verts().clear();
-
- // copy the relevant triangle indices
- newPolys.back().Verts().assign(triangleProps.begin() + j,triangleProps.begin() + j +3);
- }
-
- }
- } else {
- if (pg.Size() >= 3) {
- newPolys.push_back(poly);
- }
- }
- }
-
- // replace our polygons with the new ones.
- Polys() = newPolys;
-};
-
-template<typename TMesh>
-void MeshWrapper<TMesh>::SplitPolygon(
- const int p1Index,
- const MT_Plane3& plane,
- int& inPiece,
- int& outPiece,
- const MT_Scalar onEpsilon
-){
-
- DefaultSplitFunctionBindor<TMesh::Polygon::TVProp> defaultSplitFunction;
-
- SplitFunction<MyType,DefaultSplitFunctionBindor<TMesh::Polygon::TVProp> > splitFunction(*this,defaultSplitFunction);
- splitFunction.SplitPolygon(p1Index,plane,inPiece,outPiece,onEpsilon);
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/csg/intern/CSG_Polygon.h b/intern/csg/intern/CSG_Polygon.h
deleted file mode 100644
index 8332977da71..00000000000
--- a/intern/csg/intern/CSG_Polygon.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __POLYGON_H
-#define __POLYGON_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_IndexDefs.h"
-
-#include <algorithm>
-#include "MT_Plane3.h"
-#include "MT_Point3.h"
-
-template <typename AVProp, typename AFProp> class PolygonBase
-{
-public :
-
- // The per vertex properties
- typedef AVProp TVProp;
-
- // The per face properties
- typedef AFProp TFProp;
-
- typedef std::vector<TVProp> TVPropList;
- typedef TVPropList::iterator TVPropIt;
-
- // Functions required by the CSG library
- ////////////////////////////////////////
-
- PolygonBase():m_fProp(){}
-
- const TVPropList& Verts() const { return m_verts;}
- TVPropList& Verts() { return m_verts;}
-
- int Size() const { return m_verts.size();}
-
- int operator[](int i) const {return m_verts[i];}
-
- const TVProp& VertexProps(int i) const { return m_verts[i];}
- TVProp& VertexProps(int i) { return m_verts[i];}
-
- void SetPlane(const MT_Plane3& plane) { m_plane = plane;}
-
- const MT_Plane3& Plane() const { return m_plane;}
- MT_Vector3 Normal() const { return m_plane.Normal();}
-
- int & Classification() { return m_classification;}
- const int& Classification() const { return m_classification;}
-
- // Reverse this polygon.
- void Reverse()
- {
- std::reverse(m_verts.begin(),m_verts.end());
- m_plane.Invert();
- }
-
- // Our functions
- ////////////////
-
- TFProp& FProp(){ return m_fProp;}
- const TFProp& FProp() const { return m_fProp;}
-
- ~PolygonBase() {}
-
-private :
-
- TVPropList m_verts;
- MT_Plane3 m_plane;
-
- TFProp m_fProp;
-
- // gross waste of bits! 1 = in, 2 = out;
- int m_classification;
-
-};
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/CSG_SplitFunction.h b/intern/csg/intern/CSG_SplitFunction.h
deleted file mode 100644
index 70929a3d4ec..00000000000
--- a/intern/csg/intern/CSG_SplitFunction.h
+++ /dev/null
@@ -1,188 +0,0 @@
-#ifndef CCG_SplitFunction_H
-#define CCG_SplitFunction_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-// This class contains the all important split function.
-// It's a bit of weird definition but doing it like this
-// means we don't have to copy any code between implementations
-// that preserve mesh connectivity and those that introduce T junctions.
-
-template <typename TMesh, typename TSplitFunctionBindor> class SplitFunction
-{
-private :
-
- TMesh& m_mesh;
- TSplitFunctionBindor& m_functionBindor;
-
-public :
-
- SplitFunction( TMesh& mesh, TSplitFunctionBindor& functionBindor)
- : m_mesh(mesh), m_functionBindor(functionBindor)
- {};
-
- void
- SplitPolygon(
- const int p1Index,
- const MT_Plane3& plane,
- int& inPiece,
- int& outPiece,
- const MT_Scalar onEpsilon
- ){
-
- const TMesh::Polygon& p = m_mesh.Polys()[p1Index];
- TMesh::Polygon inP(p),outP(p);
-
- inP.Verts().clear();
- outP.Verts().clear();
-
- // Disconnect the polygon from the mesh.
- m_functionBindor.DisconnectPolygon(p1Index);
-
- int lastIndex = p.Verts().back();
- MT_Point3 lastVertex = m_mesh.Verts()[lastIndex].Pos();
-
- int lastClassification = CSG_Geometry::ComputeClassification(plane.signedDistance(lastVertex),onEpsilon);
- int totalClassification(lastClassification);
-
- // iterate through the vertex indices of the to-be-split polygon
-
- int i;
- int j=p.Size()-1;
- for (i = 0; i < p.Size(); j = i, ++i)
- {
- int newIndex = p[i];
- MT_Point3 aVertex = m_mesh.Verts()[newIndex].Pos();
- int newClassification = CSG_Geometry::ComputeClassification(plane.signedDistance(aVertex),onEpsilon);
-
- // if neither the new vertex nor the old vertex were on and they differ
- if ((newClassification != lastClassification) && newClassification && lastClassification)
- {
- // create new vertex
- int newVertexIndex = m_mesh.Verts().size();
- m_mesh.Verts().push_back(TMesh::Vertex());
-
- // work out new vertex position.
- MT_Vector3 v = aVertex - lastVertex;
- MT_Scalar sideA = plane.signedDistance(lastVertex);
-
- MT_Scalar epsilon = -sideA/plane.Normal().dot(v);
- m_mesh.Verts().back().Pos() = lastVertex + (v * epsilon);
-
- // Make a new VertexProp
- TMesh::Polygon::TVProp splitProp(newVertexIndex,p.VertexProps(j),p.VertexProps(i),epsilon);
-
-
- // add new index to both polygons.
- inP.Verts().push_back( splitProp );
- outP.Verts().push_back( splitProp );
-
- // insert vertex into any neighbouring polygons of this edge
- m_functionBindor.InsertVertexAlongEdge(lastIndex,newIndex,splitProp);
-
- }
-
- Classify(inP.Verts(),outP.Verts(),newClassification,p.VertexProps(i));
- lastClassification = newClassification;
- totalClassification |= newClassification;
- lastVertex = aVertex;
- lastIndex = newIndex;
- }
-
- if (totalClassification == 3)
- {
- // replace polygon p with the inpiece and add the outPiece to the back
- // of the mesh. we just replace the vertices as the normal will be the same.
-
- inPiece = p1Index;
- outPiece = m_mesh.Polys().size();
-
- m_mesh.Polys()[p1Index] = inP;
- m_mesh.Polys().push_back( outP );
-
- m_functionBindor.ConnectPolygon(inPiece);
- m_functionBindor.ConnectPolygon(outPiece);
-
- } else {
-
- // remember to connect back the original polygon!
- m_functionBindor.ConnectPolygon(p1Index);
-
- // dont touch the mesh but just return the index of the original polygon
- if (totalClassification == 1)
- {
- inPiece = p1Index;
- outPiece = -1;
- } else {
- outPiece = p1Index;
- inPiece = -1;
- }
- }
- }
-
-
- void Classify(
- TMesh::Polygon::TVPropList &inGroup,
- TMesh::Polygon::TVPropList &outGroup,
- int classification,
- TMesh::Polygon::TVProp prop
- ) {
- switch (classification)
- {
- case 0 :
- inGroup.push_back(prop);
- outGroup.push_back(prop);
- break;
- case 1 :
- inGroup.push_back(prop);
- break;
- case 2 :
- outGroup.push_back(prop);
- break;
- default :
- break;
- }
- }
-
- ~SplitFunction() {};
-};
-
-
-template <typename PROP> class DefaultSplitFunctionBindor
-{
-public :
-
- DefaultSplitFunctionBindor() {};
-
- void DisconnectPolygon(int){
- }
-
- void ConnectPolygon(int) {
- }
-
- void InsertVertexAlongEdge(int,int,const PROP& ) {
- }
-
- ~DefaultSplitFunctionBindor(){};
-};
-
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/CSG_TreeQueries.h b/intern/csg/intern/CSG_TreeQueries.h
deleted file mode 100644
index 1b79d2ca36d..00000000000
--- a/intern/csg/intern/CSG_TreeQueries.h
+++ /dev/null
@@ -1,158 +0,0 @@
-#ifndef CSG_TREEQUERIES_H
-#define CSG_TREEQUERIES_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_IndexDefs.h"
-#include "CSG_BBoxTree.h"
-#include "CSG_Math.h"
-
-template <typename TMesh> class TreeIntersector
-{
-public :
-
- TreeIntersector(
- const BBoxTree& a,
- const BBoxTree& b,
- OverlapTable *aOverlapsB,
- OverlapTable *bOverlapsA,
- const TMesh* meshA,
- const TMesh* meshB
- ) {
- m_aOverlapsB = aOverlapsB;
- m_bOverlapsA = bOverlapsA;
- m_meshA = meshA;
- m_meshB = meshB;
-
- MarkIntersectingPolygons(a.RootNode(),b.RootNode());
- }
-
-private :
-
- void MarkIntersectingPolygons(const BBoxNode*a,const BBoxNode *b)
- {
- if (!intersect(a->m_bbox, b->m_bbox)) return;
- if (a->m_tag == BBoxNode::LEAF && b->m_tag == BBoxNode::LEAF)
- {
- const BBoxLeaf *la = (const BBoxLeaf *)a;
- const BBoxLeaf *lb = (const BBoxLeaf *)b;
-
- PolygonGeometry<TMesh> pg1(*m_meshA,la->m_polyIndex);
- PolygonGeometry<TMesh> pg2(*m_meshB,lb->m_polyIndex);
-
- if (CSG_PolygonIntersector<PolygonGeometry<TMesh>,PolygonGeometry<TMesh> >::
- IntersectPolygons(pg1,pg2,
- m_meshA->Polys()[la->m_polyIndex].Plane(),
- m_meshB->Polys()[lb->m_polyIndex].Plane()
- )
- ) {
- (*m_aOverlapsB)[lb->m_polyIndex].push_back(la->m_polyIndex);
- (*m_bOverlapsA)[la->m_polyIndex].push_back(lb->m_polyIndex);
- }
- } else
- if ( a->m_tag == BBoxNode::LEAF ||
- (b->m_tag != BBoxNode::LEAF && a->m_bbox.Size() < b->m_bbox.Size())
- ) {
- MarkIntersectingPolygons(a,((const BBoxInternal *)b)->lson);
- MarkIntersectingPolygons(a,((const BBoxInternal *)b)->rson);
- } else {
- MarkIntersectingPolygons(((const BBoxInternal *)a)->lson,b);
- MarkIntersectingPolygons(((const BBoxInternal *)a)->rson,b);
- }
- }
-
- // Temporaries held through recursive intersection
- OverlapTable* m_aOverlapsB;
- OverlapTable* m_bOverlapsA;
- const TMesh* m_meshA;
- const TMesh* m_meshB;
-
-};
-
-template<typename TMesh> class RayTreeIntersector
-{
-public:
-
- RayTreeIntersector(
- const BBoxTree& a,
- const TMesh* meshA,
- const MT_Line3& xRay,
- int& polyIndex
- ):
- m_meshA(meshA),
- m_polyIndex(-1),
- m_lastIntersectValue(MT_INFINITY)
- {
- FindIntersectingPolygons(a.RootNode(),xRay);
- polyIndex = m_polyIndex;
- }
-
-
-private :
-
- void FindIntersectingPolygons(const BBoxNode*a,const MT_Line3& xRay)
- {
- if ((xRay.Origin().x() + m_lastIntersectValue < a->m_bbox.Lower(0)) ||
- !a->m_bbox.IntersectXRay(xRay.Origin())
- ) {
- // ray does not intersect this box.
- return;
- }
-
- if (a->m_tag == BBoxNode::LEAF)
- {
- const BBoxLeaf *la = (const BBoxLeaf *)a;
- MT_Scalar testParameter(0);
-
- PolygonGeometry<TMesh> pg(*m_meshA,la->m_polyIndex);
-
- if (
- CSG_Math<PolygonGeometry<TMesh> >::InstersectPolyWithLine3D(
- xRay,pg,m_meshA->Polys()[la->m_polyIndex].Plane(),testParameter
- )
- ) {
- if (testParameter < m_lastIntersectValue)
- {
- m_lastIntersectValue = testParameter;
- m_polyIndex = la->m_polyIndex;
- }
- }
- } else {
- FindIntersectingPolygons(((const BBoxInternal*)a)->lson,xRay);
- FindIntersectingPolygons(((const BBoxInternal*)a)->rson,xRay);
- }
- }
-
- const TMesh* m_meshA;
-
- MT_Scalar m_lastIntersectValue;
- int m_polyIndex;
-};
-
-
-
-
-
-
-
-
-
-#endif
diff --git a/intern/csg/intern/CSG_Triangulate.h b/intern/csg/intern/CSG_Triangulate.h
deleted file mode 100644
index 95c0b602ddf..00000000000
--- a/intern/csg/intern/CSG_Triangulate.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef TRIANGULATE_H
-#define TRIANGULATE_H
-
-/*****************************************************************/
-/** Static class to triangulate any contour/polygon efficiently **/
-/** You should replace Vector2d with whatever your own Vector **/
-/** class might be. Does not support polygons with holes. **/
-/** Uses STL vectors to represent a dynamic array of vertices. **/
-/** This code snippet was submitted to FlipCode.com by **/
-/** John W. Ratcliff (jratcliff@verant.com) on July 22, 2000 **/
-/** I did not write the original code/algorithm for this **/
-/** this triangulator, in fact, I can't even remember where I **/
-/** found it in the first place. However, I did rework it into **/
-/** the following black-box static class so you can make easy **/
-/** use of it in your own code. Simply replace Vector2d with **/
-/** whatever your own Vector implementation might be. **/
-/*****************************************************************/
-
-#include "CSG_IndexDefs.h"
-#include <vector> // Include STL vector class.
-class MT_Plane3;
-
-template <typename PGBinder> class CSG_Triangulate
-{
-public:
-
- CSG_Triangulate(
- );
-
- // triangulate a contour/polygon, places results in STL vector
- // as series of triangles. IT uses the major axis of the normal
- // to turn it into a 2d problem.
-
- // Should chaange this to accept a point array and a list of
- // indices into that point array. Result should be indices of those
- // indices.
- //
- // MT_Point3 global_array
- // vector<BSP_VertexInd> polygon
- // result is vector<int> into polygon.
-
- bool
- Process(
- const PGBinder& contour,
- const MT_Plane3 &normal,
- VIndexList &result
- );
-
- ~CSG_Triangulate(
- );
-
-private:
-
- // compute area of a contour/polygon
- MT_Scalar
- Area(
- const PGBinder& contour
- );
-
- // decide if point Px/Py is inside triangle defined by
- // (Ax,Ay) (Bx,By) (Cx,Cy)
-
- bool
- InsideTriangle(
- MT_Scalar Ax, MT_Scalar Ay,
- MT_Scalar Bx, MT_Scalar By,
- MT_Scalar Cx, MT_Scalar Cy,
- MT_Scalar Px, MT_Scalar Py
- );
-
-
- bool
- Snip(
- const PGBinder& contour,
- int u,
- int v,
- int w,
- int n,
- int *V
- );
-
- int m_xi;
- int m_yi;
- int m_zi;
-
- // Temporary storage
-
- VIndexList m_V;
-
-};
-
-#include "CSG_Triangulate.inl"
-
-#endif
-
-
diff --git a/intern/csg/intern/CSG_Triangulate.inl b/intern/csg/intern/CSG_Triangulate.inl
deleted file mode 100644
index d7f12201af3..00000000000
--- a/intern/csg/intern/CSG_Triangulate.inl
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#include "MT_Plane3.h"
-#include "MT_Point3.h"
-
-static const MT_Scalar EPSILON = MT_Scalar(1e-10);
-
-template <typename PGBinder>
-CSG_Triangulate<PGBinder>::
-CSG_Triangulate(
-):
- m_xi(0),
- m_yi(1)
-{
-}
-
-template <typename PGBinder>
-CSG_Triangulate<PGBinder>::
-~CSG_Triangulate(
-){
-}
-
-
-template <typename PGBinder>
- MT_Scalar
-CSG_Triangulate<PGBinder>::
-Area(
- const PGBinder& contour
-){
-
- int n = contour.Size();
- MT_Scalar A(0.0);
-
- for(int p=n-1,q=0; q<n; p=q++)
- {
- A+= contour[p][m_xi]*contour[q][m_yi] -
- contour[q][m_xi]*contour[p][m_yi];
- }
- return A*MT_Scalar(0.5);
-}
-
-/*
- InsideTriangle decides if a point P is Inside of the triangle
- defined by A, B, C.
- Or within an epsilon of it.
-*/
-
-template <typename PGBinder>
- bool
-CSG_Triangulate<PGBinder>::
-InsideTriangle(
- MT_Scalar Ax, MT_Scalar Ay,
- MT_Scalar Bx, MT_Scalar By,
- MT_Scalar Cx, MT_Scalar Cy,
- MT_Scalar Px, MT_Scalar Py
-){
- MT_Scalar ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
- MT_Scalar cCROSSap, bCROSScp, aCROSSbp;
-
- ax = Cx - Bx; ay = Cy - By;
- bx = Ax - Cx; by = Ay - Cy;
- cx = Bx - Ax; cy = By - Ay;
- apx= Px - Ax; apy= Py - Ay;
- bpx= Px - Bx; bpy= Py - By;
- cpx= Px - Cx; cpy= Py - Cy;
-
- aCROSSbp = ax*bpy - ay*bpx;
- cCROSSap = cx*apy - cy*apx;
- bCROSScp = bx*cpy - by*cpx;
-
- return ((aCROSSbp >= -EPSILON) && (bCROSScp >= -EPSILON) && (cCROSSap >= -EPSILON));
-};
-
-template <typename PGBinder>
- bool
-CSG_Triangulate<PGBinder>::
-Snip(
- const PGBinder& contour,
- int u,int v,
- int w,int n,
- int *V
-){
- MT_Scalar Ax, Ay, Bx, By, Cx, Cy;
-
- Ax = contour[V[u]][m_xi];
- Ay = contour[V[u]][m_yi];
-
- Bx = contour[V[v]][m_xi];
- By = contour[V[v]][m_yi];
-
- Cx = contour[V[w]][m_xi];
- Cy = contour[V[w]][m_yi];
-
- // Snip is passes if the area of the candidate triangle is
- // greater than 2*epsilon
- // And if none of the remaining vertices are inside the polygon
- // or within an epsilon of the boundary,
-
- if ( EPSILON > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax))) ) return false;
-#if 1
- // this check is only needed for non-convex polygons
- // well yeah but convex to me and you is not necessarily convex to opengl.
- int p;
- MT_Scalar Px,Py;
-
- for (p=0;p<n;p++)
- {
- if( (p == u) || (p == v) || (p == w) ) continue;
- Px = contour[V[p]][m_xi];
- Py = contour[V[p]][m_yi];
- if (InsideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py)) return false;
- }
-#endif
- return true;
-}
-
-template <typename PGBinder>
- bool
-CSG_Triangulate<PGBinder>::
-Process(
- const PGBinder& contour,
- const MT_Plane3 &normal,
- VIndexList &result
-){
-
- // Choose major axis of normal and assign
- // 'projection' indices m_xi,m_yi;
-
- int maj_axis = normal.Normal().closestAxis();
-
- if (maj_axis == 0) {
- m_xi = 1; m_yi = 2;
- } else
- if (maj_axis == 1) {
- m_xi = 0; m_yi = 2;
- } else {
- m_xi = 0; m_yi = 1;
- }
- m_zi = maj_axis;
-
- /* initialize list of Vertices in polygon */
-
- int n = contour.Size();
- if ( n < 3 ) return false;
-
- /* we want a counter-clockwise polygon in V */
- /* to true but we also nead to preserve the winding order
- of polygons going into the routine. We keep track of what
- we did with a little bool */
- bool is_flipped = false;
-
- if ( 0.0f < Area(contour) ) {
- for (int v=0; v<n; v++) m_V.push_back(v);
- } else {
- for(int v=0; v<n; v++) m_V.push_back((n-1)-v);
- is_flipped = true;
- }
-
- int nv = n;
-
- /* remove nv-2 Vertices, creating 1 triangle every time */
- int count = 2*nv; /* error detection */
-
- for(int m=0, v=nv-1; nv>2; )
- {
- /* if we loop, it is probably a non-simple polygon */
- if (0 >= (count--))
- {
- //** Triangulate: ERROR - probable bad polygon!
- m_V.clear();
- return false;
- }
-
- /* three consecutive vertices in current polygon, <u,v,w> */
- int u = v ; if (nv <= u) u = 0; /* previous */
- v = u+1; if (nv <= v) v = 0; /* new v */
- int w = v+1; if (nv <= w) w = 0; /* next */
-
- /* Try and snip this triangle off from the
- current polygon.*/
-
- if ( Snip(contour,u,v,w,nv,m_V.begin()) )
- {
- int a,b,c,s,t;
-
- /* true names of the vertices */
- a = m_V[u]; b = m_V[v]; c = m_V[w];
-
- /* output Triangle indices*/
- if (is_flipped) {
- result.push_back( c );
- result.push_back( b );
- result.push_back( a );
- } else {
- result.push_back( a );
- result.push_back( b );
- result.push_back( c );
- }
-
- m++;
-
- /* remove v from remaining polygon */
- for(s=v,t=v+1;t<nv;s++,t++) m_V[s] = m_V[t]; nv--;
-
- /* resest error detection counter */
- count = 2*nv;
- }
- }
-
- m_V.clear();
- return true;
-}
-
-
diff --git a/intern/csg/intern/CSG_Vertex.h b/intern/csg/intern/CSG_Vertex.h
deleted file mode 100644
index bb39dbceab5..00000000000
--- a/intern/csg/intern/CSG_Vertex.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __VERTEX_H
-#define __VERTEX_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "MT_Point3.h"
-#include <algorithm>
-#include "CSG_IndexDefs.h"
-
-
-class VertexBase
-{
-protected:
-
- // Map to this vertex position in the classified Mesh
- // or -1 if this vertex has not yet been used.
- int m_vertexMap;
-
- MT_Point3 m_pos;
-
-public :
-
- VertexBase():m_vertexMap(-1) {};
-
- // Regular vertex model
- //////////////////////
- const MT_Point3& Pos() const { return m_pos;}
- MT_Point3& Pos() {return m_pos;}
-
- int & VertexMap() { return m_vertexMap;}
- const int & VertexMap() const { return m_vertexMap;}
-
- ~VertexBase(){};
-};
-
-#endif
-
-
diff --git a/intern/csg/intern/MT_Line3.cpp b/intern/csg/intern/MT_Line3.cpp
deleted file mode 100644
index 199eaea3390..00000000000
--- a/intern/csg/intern/MT_Line3.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-//implementation of MT_Line3
-/////////////////////////////
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "MT_Line3.h"
-
-MT_Line3::MT_Line3()
-:
- m_origin(0,0,0),
- m_dir(1,0,0)
-{
- m_bounds[0] = false;
- m_bounds[1] = false;
-
- m_params[0] = 0;
- m_params[1] = 1;
-}
-
-
-MT_Line3::MT_Line3(
- const MT_Point3& p1,
- const MT_Point3& p2
-):
- m_origin(p1),
- m_dir(p2-p1)
-{
- m_bounds[0] = true;
- m_bounds[1] = true;
- m_params[0] = 0;
- m_params[1] = 1;
-}
-
-// construct infinite line from p1 in direction v
-MT_Line3::MT_Line3(
- const MT_Point3& p1,
- const MT_Vector3& v
-):
- m_origin(p1),
- m_dir(v)
-{
- m_bounds[0] = false;
- m_bounds[1] = false;
- m_params[0] = 0;
- m_params[1] = 1;
-}
-
-MT_Line3::MT_Line3(
- const MT_Point3& p1,
- const MT_Vector3& v,
- bool bound1,
- bool bound2
-):
- m_origin(p1),
- m_dir(v)
-{
- m_bounds[0] = bound1;
- m_bounds[1] = bound2;
- m_params[0] = 0;
- m_params[1] = 1;
-}
-
-
diff --git a/intern/csg/intern/MT_Line3.h b/intern/csg/intern/MT_Line3.h
deleted file mode 100644
index e36f3995b91..00000000000
--- a/intern/csg/intern/MT_Line3.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef __CGS_LINE_H
-#define __CGS_LINE_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "MT_Point3.h"
-#include "MT_Vector3.h"
-
-class MT_Line3
-{
-public :
-
- MT_Line3();
-
- // construct closed line segment from p1 -> p2
- MT_Line3(const MT_Point3& p1, const MT_Point3& p2);
-
- // construct infinite line from p1 in direction v
- MT_Line3(const MT_Point3& p1, const MT_Vector3& v);
-
- MT_Line3(const MT_Point3& p1, const MT_Vector3& v, bool bound1, bool bound2);
-
- // return an infinite ray from the point p1 in the direction v
- static MT_Line3 InfiniteRay(const MT_Point3& p1, const MT_Vector3& v);
-
- // return direction of line
- const MT_Vector3& Direction() const { return m_dir;}
-
- // return a point on the line
- const MT_Point3& Origin() const { return m_origin;}
-
- bool Bounds(int i) const {
- return (i == 0 ? m_bounds[0] : m_bounds[1]);
- }
-
- bool & Bounds(int i) {
- return (i == 0 ? m_bounds[0] : m_bounds[1]);
- }
-
- const MT_Scalar& Param(int i) const {
- return (i == 0 ? m_params[0] : m_params[1]);
- }
-
- MT_Scalar& Param(int i){
- return (i == 0 ? m_params[0] : m_params[1]);
- }
-
- // Return the smallest Vector from the point to the line
- // does not take into account bounds of line.
- MT_Vector3 UnboundSmallestVector(const MT_Point3& point) const
- {
- MT_Vector3 diff(m_origin-point);
- return diff - m_dir * diff.dot(m_dir);
- }
-
- // Return the closest parameter of the line to the
- // point.
- MT_Scalar UnboundClosestParameter(const MT_Point3& point) const
- {
- MT_Vector3 diff(m_origin-point);
- return diff.dot(m_dir);
- }
-
- MT_Scalar UnboundDistance(const MT_Point3& point) const
- {
- return UnboundSmallestVector(point).length();
- }
-
- // Return true if the line parameter t is actually within the line bounds.
- bool IsParameterOnLine(const MT_Scalar &t) const
- {
- return ((m_params[0]-MT_EPSILON < t) || (!m_bounds[0])) && ((m_params[1] > t+MT_EPSILON) || (!m_bounds[1]));
-// return ((m_params[0] < t) || (!m_bounds[0])) && ((m_params[1] > t ) || (!m_bounds[1]));
- }
-
-
-private :
-
- bool m_bounds[2];
-
- MT_Scalar m_params[2];
- MT_Point3 m_origin;
- MT_Vector3 m_dir;
-
-};
-
-
-
-
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_BlenderMesh.h b/intern/csg/intern/blender/CSG_BlenderMesh.h
deleted file mode 100644
index 1f7a841d1e2..00000000000
--- a/intern/csg/intern/blender/CSG_BlenderMesh.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef CSG_BlenderMesh_H
-#define CSG_BlenderMesh_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-//typedefs for types used to represent blender meshes in the CSG library
-
-#include "CSG_IndexDefs.h"
-#include "CSG_ConnectedMesh.h"
-
-#include "CSG_Vertex.h"
-#include "CSG_CVertex.h"
-#include "CSG_Polygon.h"
-#include "CSG_Mesh.h"
-#include "CSG_MeshWrapper.h"
-#include "CSG_Interface.h"
-#include "CSG_BlenderVProp.h"
-
-typedef PolygonBase<BlenderVProp,CSG_IFaceData> TestPolygon;
-
-typedef Mesh<TestPolygon,VertexBase> AMesh;
-typedef Mesh<TestPolygon,CVertex > AConnectedMesh;
-
-typedef MeshWrapper<AMesh> AMeshWrapper;
-typedef ConnectedMeshWrapper<AConnectedMesh> AConnectedMeshWrapper;
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_BlenderVProp.cpp b/intern/csg/intern/blender/CSG_BlenderVProp.cpp
deleted file mode 100644
index 6acbdf25e6f..00000000000
--- a/intern/csg/intern/blender/CSG_BlenderVProp.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "CSG_Interface.h"
-#include "CSG_BlenderVProp.h"
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#pragma warning( disable : 4786 )
-
-int NoFunc(
- const CSG_IFaceVertexData*,
- const CSG_IFaceVertexData*,
- CSG_IFaceVertexData*,
- double
-){
- return 0;
-}
-
-
-CSG_InterpolateUserFaceVertexDataFunc BlenderVProp::InterpFunc = &NoFunc; \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_CsgOp.cpp b/intern/csg/intern/blender/CSG_CsgOp.cpp
deleted file mode 100644
index 1ff84ab0f3b..00000000000
--- a/intern/csg/intern/blender/CSG_CsgOp.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-#pragma warning( disable : 4786 )
-
-#include "CSG_CsgOp.h"
-#include "CSG_BooleanOp.h"
-#include "CSG_BBoxTree.h"
-#include "CSG_Math.h"
-#include "CSG_GeometryBinder.h"
-#include "CSG_MeshCopier.h"
-
-#include "MEM_SmartPtr.h"
-
-using namespace std;
-
- void
-BuildTree(
- const AMesh& mesh,
- BBoxTree& tree
-) {
- int numLeaves = mesh.Polys().size();
-
- BBoxLeaf *aLeaves = new BBoxLeaf[numLeaves];
-
- int i;
- for (i=0;i< mesh.Polys().size(); i++)
- {
- PolygonGeometry<AMesh> pg(mesh,i);
- aLeaves[i] = BBoxLeaf(i,CSG_Math<PolygonGeometry<AMesh> >::FitBBox(pg) );
- }
-
- tree.BuildTree(aLeaves,numLeaves);
-}
-
-
- void
-ExtractClassificationPreserve(
- const AMesh& meshA,
- const AMesh& meshB,
- const BBoxTree& aTree,
- const BBoxTree& bTree,
- const OverlapTable& aOverlapsB,
- const OverlapTable& bOverlapsA,
- int aClassification,
- int bClassification,
- bool reverseA,
- bool reverseB,
- AMesh& output
-){
-
- // Now we need to make a copy of each mesh and then partition each of those
- // copies with respect to the original meshes.
- AConnectedMesh meshAPartitioned;
- AConnectedMesh meshBPartitioned;
-
- MeshCopier<AMesh,AConnectedMesh>::Copy(meshA,meshAPartitioned);
- MeshCopier<AMesh,AConnectedMesh>::Copy(meshB,meshBPartitioned);
-
- AConnectedMeshWrapper meshAWrapper(meshAPartitioned);
- AConnectedMeshWrapper meshBWrapper(meshBPartitioned);
-
- meshAWrapper.BuildVertexPolyLists();
- meshBWrapper.BuildVertexPolyLists();
- // Partition meshA wrt to meshB
- BooleanOp<AConnectedMeshWrapper,AMesh>::PartitionMesh(meshAWrapper,meshB,bOverlapsA);
- // and now meshB wrt meshA
- BooleanOp<AConnectedMeshWrapper,AMesh>::PartitionMesh(meshBWrapper,meshA,aOverlapsB);
-
- // Classify the partioned meshes wrt to the originals.
- BooleanOp<AConnectedMesh,AMesh>::ClassifyMesh(meshB,bTree,meshAPartitioned);
- BooleanOp<AConnectedMesh,AMesh>::ClassifyMesh(meshA,aTree,meshBPartitioned);
-
- // Extract the classification we want from both meshes
- BooleanOp<AConnectedMesh,AMesh>::ExtractClassification(meshAPartitioned, output,aClassification,reverseA);
- BooleanOp<AConnectedMesh,AMesh>::ExtractClassification(meshBPartitioned, output,bClassification,reverseB);
-}
-
- void
-ExtractClassification(
- const AMesh& meshA,
- const AMesh& meshB,
- const BBoxTree& aTree,
- const BBoxTree& bTree,
- const OverlapTable& aOverlapsB,
- const OverlapTable& bOverlapsA,
- int aClassification,
- int bClassification,
- bool reverseA,
- bool reverseB,
- AMesh& output
-){
- // Now we need to make a copy of each mesh and then partition each of those
- // copies with respect to the original meshes.
- AMesh meshAPartitioned(meshA);
- AMesh meshBPartitioned(meshB);
-
- AMeshWrapper meshAWrapper(meshAPartitioned);
- AMeshWrapper meshBWrapper(meshBPartitioned);
-
- // Partition meshA wrt to meshB
- BooleanOp<AMeshWrapper,AMesh>::PartitionMesh(meshAWrapper,meshB,bOverlapsA);
- // and now meshB wrt meshA
- BooleanOp<AMeshWrapper,AMesh>::PartitionMesh(meshBWrapper,meshA,aOverlapsB);
-
- // Classify the partioned meshes wrt to the originals.
- BooleanOp<AMesh,AMesh>::ClassifyMesh(meshB,bTree,meshAPartitioned);
- BooleanOp<AMesh,AMesh>::ClassifyMesh(meshA,aTree,meshBPartitioned);
-
- // Extract the classification we want from both meshes
- BooleanOp<AMesh,AMesh>::ExtractClassification(meshAPartitioned, output,aClassification,reverseA);
- BooleanOp<AMesh,AMesh>::ExtractClassification(meshBPartitioned, output,bClassification,reverseB);
-}
-
- AMesh *
-CsgOp::
-Intersect(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
-){
- // assumes they occups the same space and their planes have
- // been computed.
-
- // First thing is to build a BBoxTree for each mesh.
- BBoxTree aTree,bTree;
- BuildTree(meshA,aTree);
- BuildTree(meshB,bTree);
-
- // Build the overlap tables - they tell us which polygons from
- // meshA overlap with those of meshB and vice versa
- OverlapTable bOverlapsA(meshA.Polys().size());
- OverlapTable aOverlapsB(meshB.Polys().size());
-
- BooleanOp<AMesh,AMesh>::BuildSplitGroup(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA);
-
- // Create a new mesh for the output
- MEM_SmartPtr<AMesh> output = new AMesh;
- if (output == NULL) return NULL;
-
- if (preserve)
- {
- ExtractClassificationPreserve(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,1,1,false,false,output.Ref());
- } else {
- ExtractClassification(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,1,1,false,false,output.Ref());
- }
-
-#if 1
- // Triangulate the result
- AMeshWrapper outputWrapper(output.Ref());
- outputWrapper.Triangulate();
-#endif
- return output.Release();
-}
-
-
- AMesh *
-CsgOp::
-Union(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
-){
- // assumes they occups the same space and their planes have
- // been computed.
-
- // First thing is to build a BBoxTree for each mesh.
- BBoxTree aTree,bTree;
- BuildTree(meshA,aTree);
- BuildTree(meshB,bTree);
-
- // Build the overlap tables - they tell us which polygons from
- // meshA overlap with those of meshB and vice versa
- OverlapTable bOverlapsA(meshA.Polys().size());
- OverlapTable aOverlapsB(meshB.Polys().size());
-
- BooleanOp<AMesh,AMesh>::BuildSplitGroup(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA);
-
- // Create a new mesh for the output
- MEM_SmartPtr<AMesh> output = new AMesh;
- if (output == NULL) return NULL;
-
- if (preserve)
- {
- ExtractClassificationPreserve(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,2,2,false,false,output.Ref());
- } else {
- ExtractClassification(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,2,2,false,false,output.Ref());
- }
-
-#if 1
- // Triangulate the result
- AMeshWrapper outputWrapper(output.Ref());
- outputWrapper.Triangulate();
-#endif
- return output.Release();
-}
-
- AMesh *
-CsgOp::
-Difference(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
-){
-
- // assumes they occups the same space and their planes have
- // been computed.
-
- // First thing is to build a BBoxTree for each mesh.
- BBoxTree aTree,bTree;
- BuildTree(meshA,aTree);
- BuildTree(meshB,bTree);
-
- // Build the overlap tables - they tell us which polygons from
- // meshA overlap with those of meshB and vice versa
- OverlapTable bOverlapsA(meshA.Polys().size());
- OverlapTable aOverlapsB(meshB.Polys().size());
-
- BooleanOp<AMesh,AMesh>::BuildSplitGroup(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA);
-
- // Create a new mesh for the output
- MEM_SmartPtr<AMesh> output = new AMesh;
- if (output == NULL) return NULL;
-
- if (preserve)
- {
- ExtractClassificationPreserve(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,2,1,false,true,output.Ref());
- } else {
- ExtractClassification(meshA,meshB,aTree,bTree,aOverlapsB,bOverlapsA,2,1,false,true,output.Ref());
- }
-
-#if 1
- // Triangulate the result
- AMeshWrapper outputWrapper(output.Ref());
- outputWrapper.Triangulate();
-#endif
- return output.Release();
-}
-
-
diff --git a/intern/csg/intern/blender/CSG_CsgOp.h b/intern/csg/intern/blender/CSG_CsgOp.h
deleted file mode 100644
index 3b0e8b33766..00000000000
--- a/intern/csg/intern/blender/CSG_CsgOp.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef CSG_CsgOp_h
-#define CSG_CsgOp_h
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_BlenderMesh.h"
-
-
-class CsgOp
-{
-public :
-
- static
- AMesh *
- Intersect(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
- );
-
- static
- AMesh *
- Union(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
- );
-
- static
- AMesh *
- Difference(
- const AMesh& meshA,
- const AMesh& meshB,
- bool preserve
- );
-
-
-};
-
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_IndexDefs.h b/intern/csg/intern/blender/CSG_IndexDefs.h
deleted file mode 100644
index f385537d0ac..00000000000
--- a/intern/csg/intern/blender/CSG_IndexDefs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef CSG_INDEXDEFS_H
-#define CSG_INDEXDEFS_H
-
-//typdefs for lists and things in the CSG library
-
-#include <vector>
-
-typedef std::vector<int> PIndexList;
-typedef PIndexList::iterator PIndexIt;
-typedef PIndexList::const_iterator const_PIndexIt;
-
-typedef std::vector<int> VIndexList;
-typedef VIndexList::iterator VIndexIt;
-typedef VIndexList::const_iterator const_VIndexIt;
-
-typedef std::vector< PIndexList > OverlapTable;
-
-
-
-#endif
-
-
diff --git a/intern/csg/intern/blender/CSG_Interface.cpp b/intern/csg/intern/blender/CSG_Interface.cpp
deleted file mode 100644
index 8b6415f1b3a..00000000000
--- a/intern/csg/intern/blender/CSG_Interface.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-/**
- * Implementation of external C api for CSG lib .
- */
-#pragma warning( disable : 4786 )
-
-#include "CSG_Interface.h"
-#include "CSG_Iterator.h"
-#include "CSG_BlenderMesh.h"
-#include "CSG_MeshBuilder.h"
-#include "CSG_CsgOp.h"
-
-#include "MEM_SmartPtr.h"
-
-struct CSG_MeshInfo {
- MEM_SmartPtr<AMesh> output_mesh;
-};
-
- CSG_BooleanOperation *
-CSG_NewBooleanFunction(
- void
-){
- CSG_MeshInfo * mesh_info = new CSG_MeshInfo;
- CSG_BooleanOperation * output = new CSG_BooleanOperation;
-
- if (mesh_info==NULL || output==NULL) return NULL;
-
- mesh_info->output_mesh = NULL;
- output->CSG_info = mesh_info;
-
- return output;
-}
-
- int
-CSG_PerformBooleanOperation(
- CSG_BooleanOperation * operation,
- CSG_OperationType op_type,
- CSG_FaceIteratorDescriptor obAFaces,
- CSG_VertexIteratorDescriptor obAVertices,
- CSG_FaceIteratorDescriptor obBFaces,
- CSG_VertexIteratorDescriptor obBVertices,
- CSG_InterpolateUserFaceVertexDataFunc interp_func
-){
-
- if (operation == NULL) return 0;
-
- CSG_MeshInfo * mesh_info = static_cast<CSG_MeshInfo *>(operation->CSG_info);
- if (mesh_info == NULL) return 0;
-
- obAFaces.Reset(obAFaces.it);
- obBFaces.Reset(obBFaces.it);
- obAVertices.Reset(obAVertices.it);
- obBVertices.Reset(obBVertices.it);
-
- MEM_SmartPtr<AMesh> outputMesh;
-
- try {
- // Build the individual meshes
- // set the face data size
- BlenderVProp::InterpFunc = interp_func;
-
- MEM_SmartPtr<AMesh> obA = MeshBuilder::NewMesh(obAFaces,obAVertices);
-
- MEM_SmartPtr<AMesh> obB = MeshBuilder::NewMesh(obBFaces,obBVertices);
-
- if (
- obA == NULL ||
- obB == NULL
- ) {
- return 0;
- }
-
- // build normals
- AMeshWrapper aMeshWrap(obA.Ref()), bMeshWrap(obB.Ref());
- aMeshWrap.ComputePlanes();
- bMeshWrap.ComputePlanes();
-
- // translate enums!
-
- switch(op_type) {
- case e_csg_union :
- case e_csg_classify :
- outputMesh = CsgOp::Union(obA.Ref(),obB.Ref(),true);
- break;
- case e_csg_intersection :
- outputMesh = CsgOp::Intersect(obA.Ref(),obB.Ref(),true);
- break;
- case e_csg_difference :
- outputMesh = CsgOp::Difference(obA.Ref(),obB.Ref(),true);
- break;
- default :
- return 0;
- }
- }
- catch(...) {
- return 0;
- }
-
- // set the output mesh
- mesh_info->output_mesh = outputMesh;
-
- return 1;
-}
-
- int
-CSG_OutputFaceDescriptor(
- CSG_BooleanOperation * operation,
- CSG_FaceIteratorDescriptor * output
-){
- if (operation == NULL) return 0;
- CSG_MeshInfo * mesh_info = static_cast<CSG_MeshInfo *>(operation->CSG_info);
-
- if (mesh_info == NULL) return 0;
- if (mesh_info->output_mesh == NULL) return 0;
-
- AMesh_FaceIt_Construct(mesh_info->output_mesh,output);
- return 1;
-}
-
-
- int
-CSG_OutputVertexDescriptor(
- CSG_BooleanOperation * operation,
- CSG_VertexIteratorDescriptor *output
-){
- if (operation == NULL) return 0;
- CSG_MeshInfo * mesh_info = static_cast<CSG_MeshInfo *>(operation->CSG_info);
-
- if (mesh_info == NULL) return 0;
- if (mesh_info->output_mesh == NULL) return 0;
-
- AMesh_VertexIt_Construct(mesh_info->output_mesh,output);
- return 1;
-}
-
- void
-CSG_FreeVertexDescriptor(
- CSG_VertexIteratorDescriptor * v_descriptor
-){
- AMesh_VertexIt_Destruct(v_descriptor);
-}
-
-
- void
-CSG_FreeFaceDescriptor(
- CSG_FaceIteratorDescriptor * f_descriptor
-){
- AMesh_FaceIt_Destruct(f_descriptor);
-}
-
-
- void
-CSG_FreeBooleanOperation(
- CSG_BooleanOperation *operation
-){
- if (operation != NULL) {
- CSG_MeshInfo * mesh_info = static_cast<CSG_MeshInfo *>(operation->CSG_info);
- delete(mesh_info);
- delete(operation);
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/intern/csg/intern/blender/CSG_Iterator.h b/intern/csg/intern/blender/CSG_Iterator.h
deleted file mode 100644
index e349229be9e..00000000000
--- a/intern/csg/intern/blender/CSG_Iterator.h
+++ /dev/null
@@ -1,199 +0,0 @@
-
-#ifndef CSG_Iterator_H
-#define CSG_Iterator_H
-
-#include "CSG_BlenderMesh.h"
-#include "CSG_Interface.h"
-
-#include "MEM_SmartPtr.h"
-/**
- * This class defines 2 C style iterators over a CSG mesh, one for
- * vertices and 1 for faces. They conform to the iterator interface
- * defined in CSG_BooleanOps.h
- */
-
-struct AMesh_VertexIt {
- AMesh* mesh;
- AMesh::VLIST::const_iterator pos;
-};
-
-
-static
- void
-AMesh_VertexIt_Destruct(
- CSG_VertexIteratorDescriptor * vIterator
-) {
- delete ((AMesh_VertexIt *)(vIterator->it));
- vIterator->it = NULL;
- vIterator->Done = NULL;
- vIterator->Fill = NULL;
- vIterator->Reset = NULL;
- vIterator->Step = NULL;
- vIterator->num_elements = 0;
-};
-
-
-static
- int
-AMesh_VertexIt_Done(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_VertexIt * vertex_it = (AMesh_VertexIt *)it;
-
- if (vertex_it->pos < vertex_it->mesh->Verts().end() ) return 0;
- return 1;
-};
-
-static
- void
-AMesh_VertexIt_Fill(
- CSG_IteratorPtr it,
- CSG_IVertex *vert
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_VertexIt * vertex_it = (AMesh_VertexIt *)it;
-
- vertex_it->pos->Pos().getValue(vert->position);
-};
-
-static
- void
-AMesh_VertexIt_Step(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_VertexIt * vertex_it = (AMesh_VertexIt *)it;
-
- ++(vertex_it->pos);
-};
-
-static
- void
-AMesh_VertexIt_Reset(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_VertexIt * vertex_it = (AMesh_VertexIt *)it;
- vertex_it->pos = vertex_it->mesh->Verts().begin();
-};
-
-static
- void
-AMesh_VertexIt_Construct(
- AMesh *mesh,
- CSG_VertexIteratorDescriptor *output
-){
- // user should have insured mesh is not equal to NULL.
-
- output->Done = AMesh_VertexIt_Done;
- output->Fill = AMesh_VertexIt_Fill;
- output->Step = AMesh_VertexIt_Step;
- output->Reset = AMesh_VertexIt_Reset;
- output->num_elements = mesh->Verts().size();
-
- AMesh_VertexIt * v_it = new AMesh_VertexIt;
- v_it->mesh = mesh;
- v_it->pos = mesh->Verts().begin();
- output->it = v_it;
-};
-
-
-/**
- * Face iterator.
- */
-
-struct AMesh_FaceIt {
- AMesh* mesh;
- AMesh::PLIST::const_iterator pos;
-};
-
-
-static
- void
-AMesh_FaceIt_Destruct(
- CSG_FaceIteratorDescriptor *fIterator
-) {
- delete ((AMesh_FaceIt *)(fIterator->it));
- fIterator->it = NULL;
- fIterator->Done = NULL;
- fIterator->Fill = NULL;
- fIterator->Reset = NULL;
- fIterator->Step = NULL;
- fIterator->num_elements = 0;
-};
-
-
-static
- int
-AMesh_FaceIt_Done(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_FaceIt * face_it = (AMesh_FaceIt *)it;
-
- return face_it->pos >= face_it->mesh->Polys().end();
-};
-
-static
- void
-AMesh_FaceIt_Fill(
- CSG_IteratorPtr it,
- CSG_IFace *face
-){
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_FaceIt * face_it = (AMesh_FaceIt *)it;
-
- face->m_vertexData[0] = face_it->pos->VertexProps(0).Data();
- face->m_vertexData[1] = face_it->pos->VertexProps(1).Data();
- face->m_vertexData[2] = face_it->pos->VertexProps(2).Data();
-
- face->m_vertexNumber =3;
- face->m_faceData = face_it->pos->FProp();
-};
-
-static
- void
-AMesh_FaceIt_Step(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_FaceIt * face_it = (AMesh_FaceIt *)it;
- face_it->pos++;
-};
-
-static
- void
-AMesh_FaceIt_Reset(
- CSG_IteratorPtr it
-) {
- // assume CSG_IteratorPtr is of the correct type.
- AMesh_FaceIt * f_it = (AMesh_FaceIt *)it;
- f_it->pos = f_it->mesh->Polys().begin();
-};
-
-static
- void
-AMesh_FaceIt_Construct(
- AMesh * mesh,
- CSG_FaceIteratorDescriptor *output
-) {
-
- output->Done = AMesh_FaceIt_Done;
- output->Fill = AMesh_FaceIt_Fill;
- output->Step = AMesh_FaceIt_Step;
- output->Reset = AMesh_FaceIt_Reset;
-
- output->num_elements = mesh->Polys().size();
-
- AMesh_FaceIt * f_it = new AMesh_FaceIt;
- f_it->mesh = mesh;
- f_it->pos = mesh->Polys().begin();
-
- output->it = f_it;
-
-};
-
-
-#endif
-
diff --git a/intern/csg/intern/blender/CSG_MeshBuilder.h b/intern/csg/intern/blender/CSG_MeshBuilder.h
deleted file mode 100644
index 5d65acdab50..00000000000
--- a/intern/csg/intern/blender/CSG_MeshBuilder.h
+++ /dev/null
@@ -1,123 +0,0 @@
-#ifndef CSG_MeshBuilder_H
-#define CSG_MeshBuilder_H
-/*
- CSGLib - Software Library for Constructive Solid Geometry
- Copyright (C) 2003-2004 Laurence Bourn
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Please send remarks, questions and bug reports to laurencebourn@hotmail.com
-*/
-
-#include "CSG_IndexDefs.h"
-#include "CSG_Vertex.h"
-#include "CSG_Polygon.h"
-#include "CSG_Interface.h"
-#include "CSG_BlenderMesh.h"
-
-// build a mesh from external c interface to this module
-////////////////////////////////////////////////////////
-
-class MeshBuilder
-{
-
-public :
-
- // You must have set the size of the SimpleProps data ptr size
- // before calling this function.
-
- static AMesh* NewMesh(
- CSG_FaceIteratorDescriptor obBFaces,
- CSG_VertexIteratorDescriptor obBVertices
- ) {
-
- AMesh *output = new AMesh();
-
- // first get the vertices.
- AMesh::VLIST& verts = output->Verts();
-
- verts.reserve(obBVertices.num_elements);
-
- obBVertices.Reset(obBFaces.it);
-
- CSG_IVertex iVert;
-
- while (!obBVertices.Done(obBVertices.it))
- {
- obBVertices.Fill(obBVertices.it,&iVert);
-
- AMesh::Vertex aVertex;
- aVertex.Pos().setValue(iVert.position);
- verts.push_back(aVertex);
-
- obBVertices.Step(obBVertices.it);
- }
-
- // now for the faces
- ////////////////////
-
- AMesh::PLIST &faces = output->Polys();
- faces.reserve(obBFaces.num_elements);
-
- CSG_IFace iFace;
-
- while (!obBFaces.Done(obBFaces.it))
- {
- obBFaces.Fill(obBFaces.it,&iFace);
-
- AMesh::Polygon aPolygon;
- aPolygon.FProp() = iFace.m_faceData;
-
- int i;
- for (i=0;i < 3; i++)
- {
- AMesh::Polygon::TVProp vProp;
- vProp.Data() = iFace.m_vertexData[i];
- aPolygon.Verts().push_back(vProp);
- }
- faces.push_back(aPolygon);
-
- if (iFace.m_vertexNumber == 4)
- {
- AMesh::Polygon::TVProp vProp[3];
- vProp[0].Data() = iFace.m_vertexData[2];
- vProp[1].Data() = iFace.m_vertexData[3];
- vProp[2].Data() = iFace.m_vertexData[0];
-
- aPolygon.VertexProps(0) = vProp[0];
- aPolygon.VertexProps(1) = vProp[1];
- aPolygon.VertexProps(2) = vProp[2];
-
- faces.push_back(aPolygon);
- }
-
- obBFaces.Step(obBFaces.it);
- }
-
- return output;
- }
-};
-
-
-#endif
-
-
-
-
-
-
-
-
- \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_PropArray.h b/intern/csg/intern/blender/CSG_PropArray.h
deleted file mode 100644
index 7e28a2a417e..00000000000
--- a/intern/csg/intern/blender/CSG_PropArray.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef CSG_IndexProp_H
-#define CSG_IndexProp_H
-
-#include <vector>
-#include <memory.h>
-// Face and vertex props that are contained in a seperate array
-// (PropArray) and indexed through a VProp compliant thing.
-
-typedef int (*CSG_InterpFunc)(const void *d1, const void * d2, void *dnew, float epsilon);
-
-class IndexProp
-{
-private :
-
- int m_vIndex;
- int m_size;
- unsigned char *m_data;
- mutable CSG_InterpFunc m_interpFunc;
-
-public :
-
- IndexProp(const int& vIndex)
- : m_vIndex(vIndex),
- m_size(0),
- m_data(0)
- {};
-
- IndexProp(
- const int& vIndex,
- const IndexProp& p1,
- const IndexProp& p2,
- const MT_Scalar& epsilon
- ):
- m_vIndex(vIndex),
- m_data(0)
- {
- SetInterpFunc(p1.m_interpFunc);
- SetSize(p1.m_size);
- m_interpFunc(p1.m_data,p2.m_data,m_data,(float)epsilon);
- }
-
- IndexProp(const IndexProp& other)
- : m_vIndex(other.m_vIndex),
- m_data(0),
- m_interpFunc(other.m_interpFunc)
- {
- SetInterpFunc(other.m_interpFunc);
- SetSize(other.m_size);
- memcpy(m_data,other.m_data,m_size);
- }
-
- IndexProp(
- ): m_vIndex(-1),
- m_size(0),
- m_data(0)
- {};
-
- // Support conversion to an integer
- ///////////////////////////////////
- operator int(
- ) const {
- return m_vIndex;
- }
-
- // and assignment from an integer.
- //////////////////////////////////
- IndexProp&
- operator = (
- int i
- ) {
- m_vIndex = i;
- return *this;
- }
-
- IndexProp&
- operator = (
- const IndexProp& other
- ) {
- m_vIndex = other.m_vIndex;
- m_data = 0;
- SetSize(other.m_size);
- SetInterpFunc(other.m_interpFunc);
- memcpy(m_data,other.m_data,m_size);
- return *this;
- }
-
- // Our local functions
- //////////////////////
-
- void SetInterpFunc(CSG_InterpFunc interpFunc)
- {
- m_interpFunc = interpFunc;
- }
-
- void SetSize(int size)
- {
- delete[] m_data;
- m_data = new unsigned char[size];
- m_size = size;
- }
-
- int Size() const {
- return m_size;
- }
-
- void CopyData(const void * userData)
- {
- memcpy(m_data,userData,m_size);
- }
-
- void Create(int size, const void * userData, CSG_InterpFunc interpFunc)
- {
- SetInterpFunc(interpFunc);
- SetSize(size);
- CopyData(userData);
- }
-
- const unsigned char * GetData() const { return m_data;}
-
- ~IndexProp() {
- delete[] m_data;
- };
-};
-
-
-#endif \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_SimpleProp.cpp b/intern/csg/intern/blender/CSG_SimpleProp.cpp
deleted file mode 100644
index 2c8f0eedae9..00000000000
--- a/intern/csg/intern/blender/CSG_SimpleProp.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "CSG_SimpleProp.h"
-
-
-int SimpleProp::s_size = 4; \ No newline at end of file
diff --git a/intern/csg/intern/blender/CSG_SimpleProp.h b/intern/csg/intern/blender/CSG_SimpleProp.h
deleted file mode 100644
index dc8ab45c6d8..00000000000
--- a/intern/csg/intern/blender/CSG_SimpleProp.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef CSG_SIMPLEPROP_H
-#define CSG_SIMPLEPROP_H
-
-// Simple face prop contains a fixed size piece of memory
-// initiated by the client and copied round through this
-// value type by the CSG library.
-#include <memory.h>
-
-class SimpleProp
-{
-private :
-
- static int s_size;
- unsigned char * m_data;
-
-public :
-
- static void SetSize(int size) {
- s_size = size;
- }
-
- static int Size() {
- return s_size;
- }
-
- SimpleProp()
- : m_data(new unsigned char[s_size])
- {}
-
- SimpleProp(const SimpleProp& other)
- : m_data(new unsigned char[s_size])
- {
- memcpy(m_data,other.m_data,s_size);
- }
-
- SimpleProp& operator = (const SimpleProp& other)
- {
- memcpy(m_data,other.m_data,s_size);
- return *this;
- }
-
- void SetData(const void * data)
- {
- memcpy(m_data,data,s_size);
- }
-
- const unsigned char * Data() const {
- return m_data;
- }
-
-
- ~SimpleProp()
- {
- delete[] m_data;
- }
-};
-
-#endif \ No newline at end of file
diff --git a/intern/csg/make/msvc60/csg.dsp b/intern/csg/make/msvc60/csg.dsp
deleted file mode 100644
index ae67f505bc3..00000000000
--- a/intern/csg/make/msvc60/csg.dsp
+++ /dev/null
@@ -1,234 +0,0 @@
-# Microsoft Developer Studio Project File - Name="csg" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=csg - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "csg.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "csg.mak" CFG="csg - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "csg - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "csg - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "csg - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\..\obj\windows\intern\bsp\"
-# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\bsp\"
-# PROP Target_Dir ""
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX /I "../../intern/blender" /I "../../extern" /I "../../intern" /I "../../../../../lib/windows/memutil/include" /I "../.." /I "../../../../../lib/windows/moto/include" /I"..\..\..\moto\include" /I"..\..\..\memutil" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
-# ADD BASE RSC /l 0x413 /d "NDEBUG"
-# ADD RSC /l 0x413 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\bsp\libbsp.lib"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Cmds=ECHO Copying header files XCOPY /E /Y ..\..\extern\*.h ..\..\..\..\..\lib\windows\bsp\include\ ECHO Copying lib XCOPY /E /Y ..\..\..\..\obj\windows\intern\bsp\*.lib ..\..\..\..\lib\windows\bsp\lib\*.a ECHO Done
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "csg - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\..\obj\windows\intern\bsp\debug\"
-# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\bsp\debug\"
-# PROP Target_Dir ""
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../intern/blender" /I "../../extern" /I "../../intern" /I "../../../../../lib/windows/memutil/include" /I "../.." /I "../../../../../lib/windows/moto/include" /I"..\..\..\moto\include" /I"..\..\..\memutil" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
-# ADD BASE RSC /l 0x413 /d "_DEBUG"
-# ADD RSC /l 0x413 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\bsp\debug\libbsp.lib"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Cmds=ECHO Copying header files XCOPY /E /Y ..\..\extern\*.h ..\..\..\..\..\lib\windows\bsp\include\ ECHO Copying lib XCOPY /E /Y ..\..\..\..\obj\windows\intern\bsp\debug\*.lib ..\..\..\..\..\lib\windows\bsp\lib\debug\*.a ECHO Copying Debug info. XCOPY /E /Y ..\..\..\..\obj\windows\intern\bsp\debug\vc60.* ..\..\..\..\..\lib\windows\bsp\lib\debug\ ECHO Done
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "csg - Win32 Release"
-# Name "csg - Win32 Debug"
-# Begin Group "AABBTree"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BBox.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BBoxTree.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BBoxTree.h
-# End Source File
-# End Group
-# Begin Group "inlines"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_ConnectedMeshWrapper.inl
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Math.inl
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Triangulate.inl
-# End Source File
-# End Group
-# Begin Group "blender"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_BlenderMesh.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_BlenderVProp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BlenderVProp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_CsgOp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_CsgOp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_Interface.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\extern\CSG_Interface.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\blender\CSG_MeshBuilder.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BooleanOp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_BooleanOp.inl
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_ConnectedMesh.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_CVertex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_GeometryBinder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_IndexDefs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Math.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Mesh.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_MeshCopier.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_MeshWrapper.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_MeshWrapper.inl
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Polygon.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_SplitFunction.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_TreeQueries.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Triangulate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\CSG_Vertex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\MT_Line3.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\intern\MT_Line3.h
-# End Source File
-# End Target
-# End Project
diff --git a/intern/csg/make/msvc60/csg.dsw b/intern/csg/make/msvc60/csg.dsw
deleted file mode 100644
index 7f9bd29b97a..00000000000
--- a/intern/csg/make/msvc60/csg.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "csg"=.\csg.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt
index 86a60180b05..48d25901499 100644
--- a/intern/elbeem/CMakeLists.txt
+++ b/intern/elbeem/CMakeLists.txt
@@ -36,5 +36,9 @@ IF(WINDOWS)
ADD_DEFINITIONS(-DUSE_MSVC6FIXES)
ENDIF(WINDOWS)
+IF(WITH_OPENMP)
+ ADD_DEFINITIONS(-DPARALLEL=1)
+ENDIF(WITH_OPENMP)
+
BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}")
#, libtype='blender', priority=0 )
diff --git a/intern/elbeem/SConscript b/intern/elbeem/SConscript
index bb6637ba32d..bdcb0507987 100644
--- a/intern/elbeem/SConscript
+++ b/intern/elbeem/SConscript
@@ -5,7 +5,11 @@ Import('env')
sources = env.Glob('intern/*.cpp')
-defs = 'NOGUI ELBEEM_BLENDER=1'
+defs = ' NOGUI ELBEEM_BLENDER=1'
+
+if env['WITH_BF_OPENMP'] == 1:
+ defs += ' PARALLEL'
+
if env['OURPLATFORM']=='win32-vc':
defs += ' USE_MSVC6FIXES'
incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC'] + ' ' +env['BF_SDL_INC']
diff --git a/intern/elbeem/extern/elbeem.h b/intern/elbeem/extern/elbeem.h
index b3feda8bbe8..2a594dd07e6 100644
--- a/intern/elbeem/extern/elbeem.h
+++ b/intern/elbeem/extern/elbeem.h
@@ -154,7 +154,7 @@ typedef struct elbeemMesh {
short volumeInitType;
/* name of the mesh, mostly for debugging */
- char *name;
+ const char *name;
} elbeemMesh;
// API functions
diff --git a/intern/elbeem/intern/attributes.cpp b/intern/elbeem/intern/attributes.cpp
index 890d6e75c9e..464486f2500 100644
--- a/intern/elbeem/intern/attributes.cpp
+++ b/intern/elbeem/intern/attributes.cpp
@@ -103,6 +103,7 @@ void AttributeList::readMat4Gfx(string name, ntlMat4Gfx defaultValue, string sou
// set that a parameter can be given, and will be ignored...
bool AttributeList::ignoreParameter(string name, string source) {
+ name = source = ("");
return false;
}
diff --git a/intern/elbeem/intern/elbeem.h b/intern/elbeem/intern/elbeem.h
index b3feda8bbe8..2a594dd07e6 100644
--- a/intern/elbeem/intern/elbeem.h
+++ b/intern/elbeem/intern/elbeem.h
@@ -154,7 +154,7 @@ typedef struct elbeemMesh {
short volumeInitType;
/* name of the mesh, mostly for debugging */
- char *name;
+ const char *name;
} elbeemMesh;
// API functions
diff --git a/intern/elbeem/intern/isosurface.cpp b/intern/elbeem/intern/isosurface.cpp
index 9646e8581da..1b0ba13c707 100644
--- a/intern/elbeem/intern/isosurface.cpp
+++ b/intern/elbeem/intern/isosurface.cpp
@@ -13,8 +13,7 @@
#include <algorithm>
#include <stdio.h>
-// sirdude fix for solaris
-#if !defined(linux) && (defined (__sparc) || defined (__sparc__))
+#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__)))
#include <ieeefp.h>
#endif
diff --git a/intern/elbeem/intern/loop_tools.h b/intern/elbeem/intern/loop_tools.h
index 3c15a609210..70ecb9ce3e0 100644
--- a/intern/elbeem/intern/loop_tools.h
+++ b/intern/elbeem/intern/loop_tools.h
@@ -54,15 +54,84 @@
-#define unused_GRID_REGION_END() \
- } /* main_region */ \
- // end unusedGRID_REGION_END
-
// -----------------------------------------------------------------------------------
#else // PARALLEL==1
-#include "paraloop.h"
+//#include "paraloop.h"
+#define PERFORM_USQRMAXCHECK USQRMAXCHECK(usqr,ux,uy,uz, calcMaxVlen, calcMxvx,calcMxvy,calcMxvz);
+#define LIST_EMPTY(x) calcListEmpty.push_back( x );
+#define LIST_FULL(x) calcListFull.push_back( x );
+#define FSGR_ADDPART(x) calcListParts.push_back( x );
+
+
+// parallel region
+//was: # pragma omp parallel default(shared)
+#if COMPRESSGRIDS!=1
+ // requires compressed grids...!
+ ERROR!
+#endif
+
+// loop start
+#define GRID_REGION_START() \
+ { \
+ \
+ \
+ if(mSizez<2) { \
+ mPanic = 1; \
+ errFatal("ParaLoop::2D","Not valid...!", SIMWORLD_GENERICERROR); \
+ } \
+ \
+ \
+ vector<LbmPoint> calcListFull; \
+ vector<LbmPoint> calcListEmpty; \
+ vector<ParticleObject> calcListParts; \
+ LbmFloat calcMxvx, calcMxvy, calcMxvz, calcMaxVlen; \
+ calcMxvx = calcMxvy = calcMxvz = calcMaxVlen = 0.0; \
+ calcListEmpty.reserve(mListEmpty.capacity() / omp_get_num_threads() ); \
+ calcListFull.reserve( mListFull.capacity() / omp_get_num_threads() ); \
+ calcListParts.reserve(mSizex); \
+ \
+ \
+ const int id = omp_get_thread_num(); \
+ const int Nthrds = omp_get_num_threads(); \
+ \
+ \
+ \
+ \
+ \
+ int kdir = 1; \
+ \
+ int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
+ if(gridLoopBound>0){ kstart=getForZMin1(); kend=getForZMax1(mMaxRefine); } \
+ LbmFloat *ccel = NULL, *tcel = NULL; \
+ CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
+ \
+ \
+ if(mLevel[mMaxRefine].setCurr==1) { \
+ kdir = -1; \
+ int temp = kend; \
+ kend = kstart-1; \
+ kstart = temp-1; \
+ } \
+ \
+ const int Nj = mLevel[mMaxRefine].lSizey; \
+ int jstart = 0+( id * (Nj / Nthrds) ); \
+ int jend = 0+( (id+1) * (Nj / Nthrds) ); \
+ if( ((Nj/Nthrds) *Nthrds) != Nj) { \
+ errMsg("LbmFsgrSolver","Invalid domain size Nj="<<Nj<<" Nthrds="<<Nthrds); \
+ } \
+ \
+ if(jstart<gridLoopBound) jstart = gridLoopBound; \
+ if(jend>mLevel[mMaxRefine].lSizey-gridLoopBound) jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
+ \
+ debMsgStd("ParaLoop::OMP",DM_MSG,"Thread:"<<id<<" i:"<<istart<<"-"<<iend<<" j:"<<jstart<<"-"<<jend<<", k:"<<kstart<<"-"<<kend<<" ", 1); \
+ \
+
+
+
+
+// para GRID LOOP END is parainc3
#endif // PARALLEL==1
@@ -101,9 +170,11 @@
+
// old loop for COMPRESSGRIDS==0
#define old__GRID_LOOP_START() \
for(int k=kstart;k<kend;++k) { \
for(int j=1;j<mLevel[lev].lSizey-1;++j) { \
for(int i=0;i<mLevel[lev].lSizex-2; ) {
+
diff --git a/intern/elbeem/intern/ntl_geometryobject.cpp b/intern/elbeem/intern/ntl_geometryobject.cpp
index bc004b656f5..f2ebd572682 100644
--- a/intern/elbeem/intern/ntl_geometryobject.cpp
+++ b/intern/elbeem/intern/ntl_geometryobject.cpp
@@ -83,7 +83,7 @@ bool ntlGeometryObject::checkIsAnimated() {
/* Init attributes etc. of this object */
/*****************************************************************************/
#define GEOINIT_STRINGS 9
-static char *initStringStrs[GEOINIT_STRINGS] = {
+static const char *initStringStrs[GEOINIT_STRINGS] = {
"fluid",
"bnd_no","bnd_noslip",
"bnd_free","bnd_freeslip",
diff --git a/intern/elbeem/intern/ntl_vector3dim.h b/intern/elbeem/intern/ntl_vector3dim.h
index d6a7557f69d..27c3be0d71f 100644
--- a/intern/elbeem/intern/ntl_vector3dim.h
+++ b/intern/elbeem/intern/ntl_vector3dim.h
@@ -22,6 +22,7 @@
#include <math.h>
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
// hack for MSVC6.0 compiler
#ifdef _MSC_VER
@@ -202,7 +203,7 @@ private:
//! global string for formatting vector output in utilities.cpp
-extern char *globVecFormatStr;
+extern const char *globVecFormatStr;
/*************************************************************************
Outputs the object in human readable form using the format
diff --git a/intern/elbeem/intern/paraloopend.h b/intern/elbeem/intern/paraloopend.h
new file mode 100644
index 00000000000..6bb224b625a
--- /dev/null
+++ b/intern/elbeem/intern/paraloopend.h
@@ -0,0 +1,42 @@
+
+// same as grid loop_end + barrier
+
+ } // i
+ int i=0; //dummy
+ ADVANCE_POINTERS(2*gridLoopBound);
+ } // j
+
+# if COMPRESSGRIDS==1
+# if PARALLEL==1
+ //frintf(stderr," (id=%d k=%d) ",id,k);
+#pragma omp barrier
+# endif // PARALLEL==1
+# else // COMPRESSGRIDS==1
+ int i=0; //dummy
+ ADVANCE_POINTERS(mLevel[lev].lSizex*2);
+# endif // COMPRESSGRIDS==1
+
+} // all cell loop k,j,i
+
+#pragma omp critical
+{
+ if(doReduce) {
+ // synchronize global vars
+ for(int j=0; j<calcListFull.size() ; j++) mListFull.push_back( calcListFull[j] );
+ for(int j=0; j<calcListEmpty.size(); j++) mListEmpty.push_back( calcListEmpty[j] );
+ for(int j=0; j<calcListParts.size(); j++) mpParticles->addFullParticle( calcListParts[j] );
+ if(calcMaxVlen>mMaxVlen) {
+ mMxvx = calcMxvx;
+ mMxvy = calcMxvy;
+ mMxvz = calcMxvz;
+ mMaxVlen = calcMaxVlen;
+ }
+ if(0) {debMsgStd("OMP_CRIT",DM_MSG, "reduce id"<<id<<" curr: "<<mMaxVlen<<"|"<<mMxvx<<","<<mMxvy<<","<<mMxvz<<
+ " calc[ "<<calcMaxVlen<<"|"<<calcMxvx<<","<<calcMxvy<<","<<calcMxvz<<"] " ,4 ); }
+ }
+} // critical
+
+
+} /* main_region */
+ //?lobOutstrForce = true;
+
diff --git a/intern/elbeem/intern/parametrizer.cpp b/intern/elbeem/intern/parametrizer.cpp
index 0bbdc2ee363..dca0b48d265 100644
--- a/intern/elbeem/intern/parametrizer.cpp
+++ b/intern/elbeem/intern/parametrizer.cpp
@@ -14,7 +14,7 @@
#define DEBUG_PARAMCHANNELS 0
/*! param seen debug string array */
-char *ParamStrings[] = {
+const char *ParamStrings[] = {
"RelaxTime",
"Reynolds",
"Viscosity",
diff --git a/intern/elbeem/intern/particletracer.cpp b/intern/elbeem/intern/particletracer.cpp
index c537a893c27..819fcdd0b9a 100644
--- a/intern/elbeem/intern/particletracer.cpp
+++ b/intern/elbeem/intern/particletracer.cpp
@@ -325,6 +325,7 @@ void ParticleTracer::getTriangles(double time, vector<ntlTriangle> *triangles,
// suppress warnings...
vertices = NULL; triangles = NULL;
normals = NULL; objectId = 0;
+ time = 0.;
#else // ELBEEM_PLUGIN
int pcnt = 0;
// currently not used in blender
diff --git a/intern/elbeem/intern/simulation_object.cpp b/intern/elbeem/intern/simulation_object.cpp
index 19bdb119681..9b47ae696af 100644
--- a/intern/elbeem/intern/simulation_object.cpp
+++ b/intern/elbeem/intern/simulation_object.cpp
@@ -68,6 +68,7 @@ SimulationObject::~SimulationObject()
/*! init tree for certain geometry init */
/*****************************************************************************/
void SimulationObject::initGeoTree() {
+ // unused!! overriden by solver interface
if(mpGlob == NULL) {
errFatal("SimulationObject::initGeoTree error","Requires globals!", SIMWORLD_INITERROR);
return;
@@ -79,7 +80,7 @@ void SimulationObject::initGeoTree() {
char treeFlag = (1<<(mGeoInitId+4));
mpGiTree = new ntlTree( 20, 4, // warning - fixed values for depth & maxtriangles here...
scene, treeFlag );
- exit(1); // unused!? overriden by solver interface
+ // unused!! overriden by solver interface
}
/*****************************************************************************/
@@ -309,7 +310,7 @@ void SimulationObject::step( void )
// dont advance for stopped time
mpLbm->step();
mTime += mpParam->getTimestep();
-//if(mTime>0.001) { errMsg("DEBUG!!!!!!!!","quit mlsu..."); exit(1); } // PROFILE DEBUG TEST!
+ //if(mTime>0.001) { errMsg("DEBUG!!!!!!!!","quit mlsu..."); xit(1); } // PROFILE DEBUG TEST!
}
if(mpLbm->getPanic()) mPanic = true;
diff --git a/intern/elbeem/intern/solver_adap.cpp b/intern/elbeem/intern/solver_adap.cpp
index ef516a578bd..5616d805232 100644
--- a/intern/elbeem/intern/solver_adap.cpp
+++ b/intern/elbeem/intern/solver_adap.cpp
@@ -11,7 +11,9 @@
#include "solver_relax.h"
#include "particletracer.h"
-
+#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__)))
+#include <ieeefp.h>
+#endif
/*****************************************************************************/
//! coarse step functions
diff --git a/intern/elbeem/intern/solver_class.h b/intern/elbeem/intern/solver_class.h
index e6b1ad4ed53..d46f065adfd 100644
--- a/intern/elbeem/intern/solver_class.h
+++ b/intern/elbeem/intern/solver_class.h
@@ -99,10 +99,9 @@
#define LBM_INLINED inline
// sirdude fix for solaris
-#if !defined(linux) && (defined (__sparc) || defined (__sparc__))
-#include <ieeefp.h>
+#if !defined(linux) && defined(sun)
#ifndef expf
-#define expf exp
+#define expf(x) exp((double)(x))
#endif
#endif
diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp
index abec4a89c89..c953d2f47da 100644
--- a/intern/elbeem/intern/solver_init.cpp
+++ b/intern/elbeem/intern/solver_init.cpp
@@ -655,6 +655,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
int orgSz = mSizez;
double sizeReduction = 1.0;
double memEstFromFunc = -1.0;
+ double memEstFine = -1.0;
string memreqStr("");
bool firstMInit = true;
int minitTries=0;
@@ -672,7 +673,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
firstMInit=false;
calculateMemreqEstimate( mSizex, mSizey, mSizez,
- mMaxRefine, mFarFieldSize, &memEstFromFunc, &memreqStr );
+ mMaxRefine, mFarFieldSize, &memEstFromFunc, &memEstFine, &memreqStr );
double memLimit;
string memLimStr("-");
@@ -685,13 +686,36 @@ bool LbmFsgrSolver::initializeSolverMemory()
memLimit = 16.0* 1024.0*1024.0*1024.0;
memLimStr = string("16GB");
}
- if(memEstFromFunc>memLimit) {
+
+ // restrict max. chunk of 1 mem block to 1GB for windos
+ bool memBlockAllocProblem = false;
+ double maxWinMemChunk = 1100.*1024.*1024.;
+ double maxMacMemChunk = 1200.*1024.*1024.;
+ double maxDefaultMemChunk = 2.*1024.*1024.*1024.;
+ //std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG
+#ifdef WIN32
+ if(memEstFine> maxWinMemChunk) {
+ memBlockAllocProblem = true;
+ }
+#endif // WIN32
+#ifdef __APPLE__
+ if(memEstFine> maxMacMemChunk) {
+ memBlockAllocProblem = true;
+ }
+#endif // Mac
+ if(sizeof(void *)==4 && memEstFine>maxDefaultMemChunk) {
+ // max memory chunk for 32bit systems 2gig
+ memBlockAllocProblem = true;
+ }
+
+ if(memEstFromFunc>memLimit || memBlockAllocProblem) {
sizeReduction *= 0.9;
mSizex = (int)(orgSx * sizeReduction);
mSizey = (int)(orgSy * sizeReduction);
mSizez = (int)(orgSz * sizeReduction);
debMsgStd("LbmFsgrSolver::initialize",DM_WARNING,"initGridSizes: memory limit exceeded "<<
//memEstFromFunc<<"/"<<memLimit<<", "<<
+ //memEstFine<<"/"<<maxWinMemChunk<<", "<<
memreqStr<<"/"<<memLimStr<<", "<<
"retrying: "<<PRINT_VEC(mSizex,mSizey,mSizez)<<" org:"<<PRINT_VEC(orgSx,orgSy,orgSz)
, 3 );
@@ -778,10 +802,6 @@ bool LbmFsgrSolver::initializeSolverMemory()
mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize();
mLevel[ mMaxRefine ].lcellfactor = 1.0;
LONGINT rcellSize = ((mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*mLevel[mMaxRefine].lSizez) *dTotalNum);
- // +4 for safety ?
- mLevel[ mMaxRefine ].mprsFlags[0] = new CellFlagType[ rcellSize/dTotalNum +4 ];
- mLevel[ mMaxRefine ].mprsFlags[1] = new CellFlagType[ rcellSize/dTotalNum +4 ];
- ownMemCheck += 2 * sizeof(CellFlagType) * (rcellSize/dTotalNum +4);
#if COMPRESSGRIDS==0
mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ];
@@ -789,11 +809,34 @@ bool LbmFsgrSolver::initializeSolverMemory()
ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4);
#else // COMPRESSGRIDS==0
LONGINT compressOffset = (mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*dTotalNum*2);
+ // D int tmp = ( (rcellSize +compressOffset +4)/(1024*1024) )*4;
+ // D printf("Debug MEMMMM excee: %d\n", tmp);
mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +compressOffset +4 ];
mLevel[ mMaxRefine ].mprsCells[0] = mLevel[ mMaxRefine ].mprsCells[1]+compressOffset;
ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4);
#endif // COMPRESSGRIDS==0
+ if(!mLevel[ mMaxRefine ].mprsCells[1] || !mLevel[ mMaxRefine ].mprsCells[0]) {
+ errFatal("LbmFsgrSolver::initialize","Fatal: Couldnt allocate memory (1)! Aborting...",SIMWORLD_INITERROR);
+ return false;
+ }
+
+ // +4 for safety ?
+ mLevel[ mMaxRefine ].mprsFlags[0] = new CellFlagType[ rcellSize/dTotalNum +4 ];
+ mLevel[ mMaxRefine ].mprsFlags[1] = new CellFlagType[ rcellSize/dTotalNum +4 ];
+ ownMemCheck += 2 * sizeof(CellFlagType) * (rcellSize/dTotalNum +4);
+ if(!mLevel[ mMaxRefine ].mprsFlags[1] || !mLevel[ mMaxRefine ].mprsFlags[0]) {
+ errFatal("LbmFsgrSolver::initialize","Fatal: Couldnt allocate memory (2)! Aborting...",SIMWORLD_INITERROR);
+
+#if COMPRESSGRIDS==0
+ delete[] mLevel[ mMaxRefine ].mprsCells[0];
+ delete[] mLevel[ mMaxRefine ].mprsCells[1];
+#else // COMPRESSGRIDS==0
+ delete[] mLevel[ mMaxRefine ].mprsCells[1];
+#endif // COMPRESSGRIDS==0
+ return false;
+ }
+
LbmFloat lcfdimFac = 8.0;
if(LBMDIM==2) lcfdimFac = 4.0;
for(int i=mMaxRefine-1; i>=0; i--) {
diff --git a/intern/elbeem/intern/solver_interface.cpp b/intern/elbeem/intern/solver_interface.cpp
index 8dcfa495b95..d25850a003b 100644
--- a/intern/elbeem/intern/solver_interface.cpp
+++ b/intern/elbeem/intern/solver_interface.cpp
@@ -141,7 +141,7 @@ void initGridSizes(int &sizex, int &sizey, int &sizez,
void calculateMemreqEstimate( int resx,int resy,int resz,
int refine, float farfield,
- double *reqret, string *reqstr) {
+ double *reqret, double *reqretFine, string *reqstr) {
// debug estimation?
const bool debugMemEst = true;
// COMPRESSGRIDS define is not available here, make sure it matches
@@ -149,6 +149,7 @@ void calculateMemreqEstimate( int resx,int resy,int resz,
// make sure we can handle bid numbers here... all double
double memCnt = 0.0;
double ddTotalNum = (double)dTotalNum;
+ if(reqretFine) *reqretFine = -1.;
double currResx = (double)resx;
double currResy = (double)resy;
@@ -158,10 +159,12 @@ void calculateMemreqEstimate( int resx,int resy,int resz,
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG,"res:"<<PRINT_VEC(currResx,currResy,currResz)<<" rcellSize:"<<rcellSize<<" mc:"<<memCnt, 10);
if(!useGridComp) {
memCnt += (double)(sizeof(LbmFloat) * (rcellSize +4.0) *2.0);
+ if(reqretFine) *reqretFine = (double)(sizeof(LbmFloat) * (rcellSize +4.0) *2.0);
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," no-comp, mc:"<<memCnt, 10);
} else {
double compressOffset = (double)(currResx*currResy*ddTotalNum*2.0);
memCnt += (double)(sizeof(LbmFloat) * (rcellSize+compressOffset +4.0));
+ if(reqretFine) *reqretFine = (double)(sizeof(LbmFloat) * (rcellSize+compressOffset +4.0));
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," w-comp, mc:"<<memCnt, 10);
}
for(int i=refine-1; i>=0; i--) {
@@ -186,7 +189,7 @@ void calculateMemreqEstimate( int resx,int resy,int resz,
// cpdata init check missing...
double memd = memCnt;
- char *sizeStr = "";
+ const char *sizeStr = "";
const double sfac = 1024.0;
if(memd>sfac){ memd /= sfac; sizeStr="KB"; }
if(memd>sfac){ memd /= sfac; sizeStr="MB"; }
diff --git a/intern/elbeem/intern/solver_interface.h b/intern/elbeem/intern/solver_interface.h
index 1dfdf156ee5..c3dc4983cac 100644
--- a/intern/elbeem/intern/solver_interface.h
+++ b/intern/elbeem/intern/solver_interface.h
@@ -21,7 +21,7 @@
#if LBM_USE_GUI==1
#define USE_GLUTILITIES
// for debug display
-#include <GL/gl.h>
+//#include <GL/gl.h>
#include "../gui/guifuncs.h"
#endif
@@ -596,8 +596,10 @@ class LbmSolverInterface
void initGridSizes(int &mSizex, int &mSizey, int &mSizez,
ntlVec3Gfx &mvGeoStart, ntlVec3Gfx &mvGeoEnd,
int mMaxRefine, bool parallel);
+// return the amount of memory required in total (reqret)
+// and for the finest grid only (reqretFine, can be NULL)
void calculateMemreqEstimate(int resx,int resy,int resz, int refine,
- float farfieldsize, double *reqret, string *reqstr);
+ float farfieldsize, double *reqret, double *reqretFine, string *reqstr);
//! helper function to convert flag to string (for debuggin)
string convertCellFlagType2String( CellFlagType flag );
diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp
index bced75ab444..13ebf91b696 100644
--- a/intern/elbeem/intern/solver_main.cpp
+++ b/intern/elbeem/intern/solver_main.cpp
@@ -11,6 +11,12 @@
#include "solver_relax.h"
#include "particletracer.h"
#include "loop_tools.h"
+#include <stdlib.h>
+
+#if (defined (__sun__) || defined (__sun)) || (!defined(linux) && (defined (__sparc) || defined (__sparc__)))
+#include <ieeefp.h>
+#endif
+
/*****************************************************************************/
/*! perform a single LBM step */
@@ -374,7 +380,11 @@ LbmFsgrSolver::mainLoop(int lev)
const int gridLoopBound=1;
GRID_REGION_INIT();
#if PARALLEL==1
-#include "paraloopstart.h"
+#pragma omp parallel default(shared) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+ calcNumUsedCells )
GRID_REGION_START();
#else // PARALLEL==1
GRID_REGION_START();
@@ -1111,7 +1121,11 @@ LbmFsgrSolver::preinitGrids()
GRID_REGION_INIT();
#if PARALLEL==1
-#include "paraloopstart.h"
+#pragma omp parallel default(shared) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+ calcNumUsedCells )
#endif // PARALLEL==1
GRID_REGION_START();
GRID_LOOP_START();
@@ -1144,7 +1158,11 @@ LbmFsgrSolver::standingFluidPreinit()
GRID_REGION_INIT();
#if PARALLEL==1
-#include "paraloopstart.h"
+#pragma omp parallel default(shared) \
+ reduction(+: \
+ calcCurrentMass,calcCurrentVolume, \
+ calcCellsFilled,calcCellsEmptied, \
+ calcNumUsedCells )
#endif // PARALLEL==1
GRID_REGION_START();
diff --git a/intern/elbeem/intern/solver_util.cpp b/intern/elbeem/intern/solver_util.cpp
index 43be8af46df..a6685babe68 100644
--- a/intern/elbeem/intern/solver_util.cpp
+++ b/intern/elbeem/intern/solver_util.cpp
@@ -15,6 +15,7 @@
#include "ntl_world.h"
#include "simulation_object.h"
+#include <stdlib.h>
#include <zlib.h>
#ifndef sqrtf
#define sqrtf sqrt
diff --git a/intern/elbeem/intern/utilities.cpp b/intern/elbeem/intern/utilities.cpp
index ad827efa2fc..551c4d0d384 100644
--- a/intern/elbeem/intern/utilities.cpp
+++ b/intern/elbeem/intern/utilities.cpp
@@ -55,7 +55,7 @@ int isSimworldOk(void) {
char gElbeemErrorString[256] = {'-','\0' };
// access elbeem simulator error string
-void setElbeemErrorString(char* set) {
+void setElbeemErrorString(const char* set) {
strncpy(gElbeemErrorString, set, 256);
}
char* getElbeemErrorString(void) { return gElbeemErrorString; }
@@ -76,7 +76,7 @@ int globalFirstEnvCheck = 0;
void resetGlobalColorSetting() { globalColorSetting = DEF_globalColorSetting; }
// global string for formatting vector output, TODO test!?
-char *globVecFormatStr = "V[%f,%f,%f]";
+const char *globVecFormatStr = "V[%f,%f,%f]";
// global mp on/off switch
@@ -481,7 +481,7 @@ double elbeemEstimateMemreq(int res,
double memreq = -1.0;
string memreqStr("");
// ignore farfield for now...
- calculateMemreqEstimate(resx,resy,resz, refine, 0., &memreq, &memreqStr );
+ calculateMemreqEstimate(resx,resy,resz, refine, 0., &memreq, NULL, &memreqStr );
if(retstr) {
// copy at max. 32 characters
diff --git a/intern/elbeem/intern/utilities.h b/intern/elbeem/intern/utilities.h
index 4d887c3f99b..825e92251fe 100644
--- a/intern/elbeem/intern/utilities.h
+++ b/intern/elbeem/intern/utilities.h
@@ -45,7 +45,7 @@ int getElbeemState(void);
int isSimworldOk(void);
// access elbeem simulator error string
-void setElbeemErrorString(char* set);
+void setElbeemErrorString(const char* set);
char* getElbeemErrorString(void);
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 2b17b8f8c61..11b0204eacb 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -771,6 +771,18 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
*/
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
+
+/**
+ * Return the data from the clipboad
+ * @return clipboard data
+ */
+extern GHOST_TUns8* GHOST_getClipboard(int flag);
+
+/**
+ * Put data to the Clipboard
+ */
+extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 381aac64de0..0cb860d8158 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -352,6 +352,18 @@ public:
*/
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
+ /**
+ * Returns the selection buffer
+ * @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
+ *
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+
+ /**
+ * Put data to the Clipboard
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 054cd507d1d..8c93788ee1b 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -817,3 +817,16 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
return result;
}
+
+GHOST_TUns8* GHOST_getClipboard(int flag)
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system->getClipboard(flag);
+}
+
+void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag)
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ system->putClipboard(buffer, flag);
+}
+
diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index b36143ee1a9..f806daee86b 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -116,7 +116,7 @@ GHOST_DisplayManager::getDisplaySetting(
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
- if (display < numDisplays && index < m_settings[display].size()) {
+ if (display < numDisplays && ((GHOST_TUns8)index < m_settings[display].size())) {
setting = m_settings[display][index];
}
else {
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 4c797fbaa80..8477d70c42f 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -285,6 +285,21 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const = 0;
+ /**
+ * Returns the selection buffer
+ * @param flag Only used on X11
+ * @return Returns the clipboard data
+ *
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const = 0;
+
+ /**
+ * Put data to the Clipboard
+ * @param buffer The buffer to copy to the clipboard
+ * @param flag The clipboard to copy too only used on X11
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 7f1a2467d1a..cf4015815a9 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -1115,3 +1115,71 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
return err;
}
+
+GHOST_TUns8* GHOST_SystemCarbon::getClipboard(int flag) const
+{
+ PasteboardRef inPasteboard;
+ PasteboardItemID itemID;
+ CFDataRef flavorData;
+ OSStatus err = noErr;
+ GHOST_TUns8 * temp_buff;
+ CFRange range;
+
+ err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardSynchronize( inPasteboard );
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardGetItemIdentifier( inPasteboard, 1, &itemID );
+ if(err != noErr) { return NULL;}
+
+ err = PasteboardCopyItemFlavorData( inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData);
+ if(err != noErr) { return NULL;}
+
+ range = CFRangeMake(0, CFDataGetLength(flavorData));
+
+ temp_buff = (GHOST_TUns8*) malloc(range.length+1);
+
+ CFDataGetBytes(flavorData, range, (UInt8*)temp_buff);
+
+ temp_buff[range.length] = '\0';
+
+ if(temp_buff) {
+ return temp_buff;
+ } else {
+ return NULL;
+ }
+}
+
+void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, int flag) const
+{
+ if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+ PasteboardRef inPasteboard;
+ CFDataRef textData = NULL;
+ OSStatus err = noErr; /*For error checking*/
+
+ err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
+ if(err != noErr) { return;}
+
+ err = PasteboardSynchronize( inPasteboard );
+ if(err != noErr) { return;}
+
+ err = PasteboardClear( inPasteboard );
+ if(err != noErr) { return;}
+
+ textData = CFDataCreate(kCFAllocatorDefault, (UInt8*)buffer, strlen(buffer));
+
+ if (textData) {
+ err = PasteboardPutItemFlavor( inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
+ if(err != noErr) {
+ if(textData) { CFRelease(textData);}
+ return;
+ }
+ }
+
+ if(textData) {
+ CFRelease(textData);
+ }
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index f2e3a775701..68e2d059226 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -60,12 +60,12 @@ public:
/**
* Constructor.
*/
- GHOST_SystemCarbon::GHOST_SystemCarbon();
+ GHOST_SystemCarbon();
/**
* Destructor.
*/
- GHOST_SystemCarbon::~GHOST_SystemCarbon();
+ ~GHOST_SystemCarbon();
/***************************************************************************************
** Time(r) functionality
@@ -168,6 +168,20 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
+ /**
+ * Returns Clipboard data
+ * @param flag Indicate which buffer to return
+ * @return Returns the selected buffer
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param buffer The buffer to be copied
+ * @param flag Indicates which buffer to copy too Only used on X11
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 5f4bfe9d668..c15e4f1246c 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -54,7 +54,7 @@
#define WM_MOUSEWHEEL 0x020A
#endif // WM_MOUSEWHEEL
#ifndef WHEEL_DELTA
-#define WHEEL_DELTA 120 /* Value for rolling one detent */
+#define WHEEL_DELTA 120 /* Value for rolling one detent, (old convention! MS changed it) */
#endif // WHEEL_DELTA
@@ -481,7 +481,11 @@ GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WP
{
// short fwKeys = LOWORD(wParam); // key flags
int zDelta = (short) HIWORD(wParam); // wheel rotation
- zDelta /= WHEEL_DELTA;
+
+ // zDelta /= WHEEL_DELTA;
+ // temporary fix below: microsoft now has added more precision, making the above division not work
+ if (zDelta <= 0 ) zDelta= -1; else zDelta= 1;
+
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
return new GHOST_EventWheel (getSystem()->getMilliSeconds(), window, zDelta);
@@ -893,3 +897,54 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
return lResult;
}
+
+GHOST_TUns8* GHOST_SystemWin32::getClipboard(int flag) const
+{
+ char *buffer;
+ char *temp_buff;
+
+ if ( OpenClipboard(NULL) ) {
+ HANDLE hData = GetClipboardData( CF_TEXT );
+ buffer = (char*)GlobalLock( hData );
+
+ temp_buff = (char*) malloc(strlen(buffer)+1);
+ strcpy(temp_buff, buffer);
+
+ GlobalUnlock( hData );
+ CloseClipboard();
+
+ temp_buff[strlen(buffer)] = '\0';
+ if (buffer) {
+ return (GHOST_TUns8*)temp_buff;
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+}
+
+void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, int flag) const
+{
+ if(flag == 1) {return;} //If Flag is 1 means the selection and is used on X11
+ if (OpenClipboard(NULL)) {
+ HLOCAL clipbuffer;
+ char *data;
+
+ if (buffer) {
+ EmptyClipboard();
+
+ clipbuffer = LocalAlloc(LMEM_FIXED,((strlen(buffer)+1)));
+ data = (char*)GlobalLock(clipbuffer);
+
+ strcpy(data, (char*)buffer);
+ data[strlen(buffer)] = '\0';
+ LocalUnlock(clipbuffer);
+ SetClipboardData(CF_TEXT,clipbuffer);
+ }
+ CloseClipboard();
+ } else {
+ return;
+ }
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 218fc5794eb..762e5a988a4 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -170,6 +170,20 @@ public:
*/
virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
+ /**
+ * Returns unsinged char from CUT_BUFFER0
+ * @param flag Flag is not used on win32 on used on X11
+ * @return Returns the Clipboard
+ */
+ virtual GHOST_TUns8* getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param flag Flag is not used on win32 on used on X11
+ * @return No return
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 9d4717b00ef..47bcb76441f 100755..100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -66,6 +66,7 @@
#include <unistd.h>
#include <vector>
+#include <stdio.h> // for fprintf only
typedef struct NDOFPlatformInfo {
Display *display;
@@ -79,6 +80,11 @@ typedef struct NDOFPlatformInfo {
static NDOFPlatformInfo sNdofInfo = {NULL, 0, NULL, 0, 0, 0, 0};
+
+//these are for copy and select copy
+static char *txt_cut_buffer= NULL;
+static char *txt_select_buffer= NULL;
+
using namespace std;
GHOST_SystemX11::
@@ -316,7 +322,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
if (!window) {
return;
}
-
+
switch (xe->type) {
case Expose:
{
@@ -510,8 +516,57 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case MappingNotify:
case ReparentNotify:
break;
-
- default: {
+ case SelectionRequest:
+ {
+ XEvent nxe;
+ Atom target, string, compound_text, c_string;
+ XSelectionRequestEvent *xse = &xe->xselectionrequest;
+
+ target = XInternAtom(m_display, "TARGETS", False);
+ string = XInternAtom(m_display, "STRING", False);
+ compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
+ c_string = XInternAtom(m_display, "C_STRING", False);
+
+ /* support obsolete clients */
+ if (xse->property == None) {
+ xse->property = xse->target;
+ }
+
+ nxe.xselection.type = SelectionNotify;
+ nxe.xselection.requestor = xse->requestor;
+ nxe.xselection.property = xse->property;
+ nxe.xselection.display = xse->display;
+ nxe.xselection.selection = xse->selection;
+ nxe.xselection.target = xse->target;
+ nxe.xselection.time = xse->time;
+
+ /*Check to see if the requestor is asking for String*/
+ if(xse->target == string || xse->target == compound_text || xse->target == c_string) {
+ if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_select_buffer, strlen(txt_select_buffer));
+ } else if (xse->selection == XInternAtom(m_display, "CLIPBOARD", False)) {
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_cut_buffer, strlen(txt_cut_buffer));
+ }
+ } else if (xse->target == target) {
+ Atom alist[4];
+ alist[0] = target;
+ alist[1] = string;
+ alist[2] = compound_text;
+ alist[3] = c_string;
+ XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 32, PropModeReplace, (unsigned char*)alist, 4);
+ XFlush(m_display);
+ } else {
+ //Change property to None because we do not support anything but STRING
+ nxe.xselection.property = None;
+ }
+
+ //Send the event to the client 0 0 == False, SelectionNotify
+ XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
+ XFlush(m_display);
+ break;
+ }
+
+ default: {
if(xe->type == window->GetXTablet().MotionEvent)
{
XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
@@ -893,3 +948,113 @@ convertXKey(
}
#undef GXMAP
+
+ GHOST_TUns8*
+GHOST_SystemX11::
+getClipboard(int flag
+) const {
+ //Flag
+ //0 = Regular clipboard 1 = selection
+ static Atom Primary_atom, clip_String, compound_text;
+ Atom rtype;
+ Window m_window, owner;
+ unsigned char *data, *tmp_data;
+ int bits;
+ unsigned long len, bytes;
+ XEvent xevent;
+
+ 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();
+
+ clip_String = XInternAtom(m_display, "_BLENDER_STRING", False);
+ compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
+
+ //lets check the owner and if it is us then return the static buffer
+ if(flag == 0) {
+ Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner == m_window) {
+ data = (unsigned char*) malloc(strlen(txt_cut_buffer));
+ strcpy((char*)data, txt_cut_buffer);
+ return (GHOST_TUns8*)data;
+ } else if (owner == None) {
+ return NULL;
+ }
+ } else {
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner == m_window) {
+ data = (unsigned char*) malloc(strlen(txt_select_buffer));
+ strcpy((char*)data, txt_select_buffer);
+ return (GHOST_TUns8*)data;
+ } else if (owner == None) {
+ return NULL;
+ }
+ }
+
+ if(!Primary_atom) {
+ return NULL;
+ }
+
+ XDeleteProperty(m_display, m_window, Primary_atom);
+ XConvertSelection(m_display, Primary_atom, compound_text, clip_String, m_window, CurrentTime); //XA_STRING
+ XFlush(m_display);
+
+ //This needs to change so we do not wait for ever or check owner first
+ while(1) {
+ XNextEvent(m_display, &xevent);
+ if(xevent.type == SelectionNotify) {
+ if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
+ tmp_data = (unsigned char*) malloc(strlen((char*)data));
+ strcpy((char*)tmp_data, (char*)data);
+ XFree(data);
+ return (GHOST_TUns8*)tmp_data;
+ }
+ return NULL;
+ }
+ }
+}
+
+ void
+GHOST_SystemX11::
+putClipboard(
+GHOST_TInt8 *buffer, int flag) const
+{
+ static Atom Primary_atom;
+ Window m_window, owner;
+
+ if(!buffer) {return;}
+
+ if(flag == 0) {
+ Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
+ if(txt_cut_buffer) { free((void*)txt_cut_buffer); }
+
+ txt_cut_buffer = (char*) malloc(strlen(buffer));
+ strcpy(txt_cut_buffer, buffer);
+ } else {
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ if(txt_select_buffer) { free((void*)txt_select_buffer); }
+
+ txt_select_buffer = (char*) malloc(strlen(buffer));
+ strcpy(txt_select_buffer, buffer);
+ }
+
+ 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();
+
+ if(!Primary_atom) {
+ return;
+ }
+
+ XSetSelectionOwner(m_display, Primary_atom, m_window, CurrentTime);
+ owner = XGetSelectionOwner(m_display, Primary_atom);
+ if (owner != m_window)
+ fprintf(stderr, "failed to own primary\n");
+
+ return;
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index e6adff44155..1c100bee852 100755..100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -201,6 +201,21 @@ public:
volatile GHOST_TEventNDOFData *current_values
);
+ /**
+ * Returns unsinged char from CUT_BUFFER0
+ * @param flag Flag indicates which buffer to return 0 for clipboard 1 for selection
+ * @return Returns the Clipboard indicated by Flag
+ */
+ GHOST_TUns8*
+ getClipboard(int flag) const;
+
+ /**
+ * Puts buffer to system clipboard
+ * @param buffer The buffer to copy to the clipboard
+ * @param flag Flag indicates which buffer to set ownership of 0 for clipboard 1 for selection
+ */
+ virtual void putClipboard(GHOST_TInt8 *buffer, int flag) const;
+
private :
Display * m_display;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 056b5756587..1b9b3c491d5 100755..100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -38,6 +38,13 @@
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
+#if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__)
+#include <strings.h>
+#endif
+
+#include <cstring>
+#include <cstdio>
+
// For obscure full screen mode stuuf
// lifted verbatim from blut.
@@ -168,6 +175,7 @@ GHOST_WindowX11(
if (m_visual == NULL) {
// barf : no visual meeting these requirements could be found.
+ printf("%s:%d: X11 glxChooseVisual() failed for OpenGL, verify working openGL system!\n", __FILE__, __LINE__);
return;
}
@@ -196,7 +204,7 @@ GHOST_WindowX11(
KeyPressMask | KeyReleaseMask |
EnterWindowMask | LeaveWindowMask |
ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | FocusChangeMask;
+ PointerMotionMask | FocusChangeMask | PropertyChangeMask;
// create the window!
@@ -758,6 +766,15 @@ validate(
GHOST_WindowX11::
~GHOST_WindowX11(
){
+ static Atom Primary_atom, Clipboard_atom;
+ Window p_owner, c_owner;
+ /*Change the owner of the Atoms to None if we are the owner*/
+ Primary_atom = XInternAtom(m_display, "PRIMARY", False);
+ Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
+
+ p_owner = XGetSelectionOwner(m_display, Primary_atom);
+ c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
+
std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
for (; it != m_standard_cursors.end(); it++) {
XFreeCursor(m_display, it->second);
@@ -776,6 +793,14 @@ GHOST_WindowX11::
}
glXDestroyContext(m_display, m_context);
}
+
+ if (p_owner == m_window) {
+ XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
+ }
+ if (c_owner == m_window) {
+ XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
+ }
+
XDestroyWindow(m_display, m_window);
XFree(m_visual);
}
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 26a9258d03b..73eddff7d8a 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -100,9 +100,16 @@ extern "C" {
void *MEM_mapallocN(unsigned int len, const char * str);
/** Print a list of the names and sizes of all allocated memory
+ * blocks. as a python dict for easy investigation */
+ void MEM_printmemlist_pydict(void);
+
+ /** Print a list of the names and sizes of all allocated memory
* blocks. */
void MEM_printmemlist(void);
+ /** Print statistics about memory usage */
+ void MEM_printmemlist_stats(void);
+
/** Set the callback function for error output. */
void MEM_set_error_callback(void (*func)(char *));
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 51c2a2427b5..20d3a5b07fc 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -332,25 +332,146 @@ void *MEM_mapallocN(unsigned int len, const char *str)
#endif
}
+/* Memory statistics print */
+typedef struct MemPrintBlock {
+ const char *name;
+ unsigned long len;
+ int items;
+} MemPrintBlock;
+
+static int compare_name(const void *p1, const void *p2)
+{
+ const MemPrintBlock *pb1= (const MemPrintBlock*)p1;
+ const MemPrintBlock *pb2= (const MemPrintBlock*)p2;
+
+ return strcmp(pb1->name, pb2->name);
+}
+
+static int compare_len(const void *p1, const void *p2)
+{
+ const MemPrintBlock *pb1= (const MemPrintBlock*)p1;
+ const MemPrintBlock *pb2= (const MemPrintBlock*)p2;
+
+ if(pb1->len < pb2->len)
+ return 1;
+ else if(pb1->len == pb2->len)
+ return 0;
+ else
+ return -1;
+}
-void MEM_printmemlist()
+void MEM_printmemlist_stats()
{
MemHead *membl;
+ MemPrintBlock *pb, *printblock;
+ int totpb, a, b;
mem_lock_thread();
+ /* put memory blocks into array */
+ printblock= malloc(sizeof(MemPrintBlock)*totblock);
+
+ pb= printblock;
+ totpb= 0;
+
membl = membase->first;
if (membl) membl = MEMNEXT(membl);
+
while(membl) {
- print_error("%s len: %d %p\n",membl->name,membl->len, membl+1);
+ pb->name= membl->name;
+ pb->len= membl->len;
+ pb->items= 1;
+
+ totpb++;
+ pb++;
+
if(membl->next)
membl= MEMNEXT(membl->next);
else break;
}
+ /* sort by name and add together blocks with the same name */
+ qsort(printblock, totpb, sizeof(MemPrintBlock), compare_name);
+ for(a=0, b=0; a<totpb; a++) {
+ if(a == b) {
+ continue;
+ }
+ else if(strcmp(printblock[a].name, printblock[b].name) == 0) {
+ printblock[b].len += printblock[a].len;
+ printblock[b].items++;
+ }
+ else {
+ b++;
+ memcpy(&printblock[b], &printblock[a], sizeof(MemPrintBlock));
+ }
+ }
+ totpb= b+1;
+
+ /* sort by length and print */
+ qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
+ printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
+ for(a=0, pb=printblock; a<totpb; a++, pb++)
+ printf("%s items: %d, len: %.3f MB\n", pb->name, pb->items, (double)pb->len/(double)(1024*1024));
+
+ free(printblock);
+
+ mem_unlock_thread();
+}
+
+/* Prints in python syntax for easy */
+static void MEM_printmemlist_internal( int pydict )
+{
+ MemHead *membl;
+
+ mem_lock_thread();
+
+ membl = membase->first;
+ if (membl) membl = MEMNEXT(membl);
+
+ if (pydict) {
+ print_error("# membase_debug.py\n");
+ print_error("membase = [\\\n");
+ }
+ while(membl) {
+ if (pydict) {
+ fprintf(stderr, "{'len':%i, 'name':'''%s''', 'pointer':'%p'},\\\n", membl->len, membl->name, membl+1);
+ } else {
+ print_error("%s len: %d %p\n",membl->name,membl->len, membl+1);
+ }
+ if(membl->next)
+ membl= MEMNEXT(membl->next);
+ else break;
+ }
+ if (pydict) {
+ fprintf(stderr, "]\n\n");
+ fprintf(stderr,
+"mb_userinfo = {}\n"
+"totmem = 0\n"
+"for mb_item in membase:\n"
+"\tmb_item_user_size = mb_userinfo.setdefault(mb_item['name'], [0,0])\n"
+"\tmb_item_user_size[0] += 1 # Add a user\n"
+"\tmb_item_user_size[1] += mb_item['len'] # Increment the size\n"
+"\ttotmem += mb_item['len']\n"
+"print '(membase) items:', len(membase), '| unique-names:', len(mb_userinfo), '| total-mem:', totmem\n"
+"mb_userinfo_sort = mb_userinfo.items()\n"
+"for sort_name, sort_func in (('size', lambda a: -a[1][1]), ('users', lambda a: -a[1][0]), ('name', lambda a: a[0])):\n"
+"\tprint '\\nSorting by:', sort_name\n"
+"\tmb_userinfo_sort.sort(key = sort_func)\n"
+"\tfor item in mb_userinfo_sort:\n"
+"\t\tprint 'name:%%s, users:%%i, len:%%i' %% (item[0], item[1][0], item[1][1])\n"
+ );
+ }
+
mem_unlock_thread();
}
+void MEM_printmemlist( void ) {
+ MEM_printmemlist_internal(0);
+}
+void MEM_printmemlist_pydict( void ) {
+ MEM_printmemlist_internal(1);
+}
+
short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
{
short error = 0;
@@ -408,8 +529,10 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
} else{
error = -1;
name = check_memlist(memh);
- if (name == 0) MemorY_ErroR("free","pointer not in memlist");
- else MemorY_ErroR(name,"error in header");
+ if (name == 0)
+ MemorY_ErroR("free","pointer not in memlist");
+ else
+ MemorY_ErroR(name,"error in header");
}
totblock--;
diff --git a/intern/iksolver/extern/IK_solver.h b/intern/iksolver/extern/IK_solver.h
index 8626ca22beb..bf53a9e3724 100644
--- a/intern/iksolver/extern/IK_solver.h
+++ b/intern/iksolver/extern/IK_solver.h
@@ -158,6 +158,8 @@ void IK_FreeSolver(IK_Solver *solver);
void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float weight);
void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[][3], float weight);
+void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle);
+float IK_SolverGetPoleAngle(IK_Solver *solver);
int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations);
diff --git a/intern/iksolver/intern/IK_QJacobian.cpp b/intern/iksolver/intern/IK_QJacobian.cpp
index 03c5f9500be..1dd4d086aa8 100644
--- a/intern/iksolver/intern/IK_QJacobian.cpp
+++ b/intern/iksolver/intern/IK_QJacobian.cpp
@@ -42,11 +42,10 @@ IK_QJacobian::~IK_QJacobian()
{
}
-void IK_QJacobian::ArmMatrices(int dof, int task_size, int tasks)
+void IK_QJacobian::ArmMatrices(int dof, int task_size)
{
m_dof = dof;
m_task_size = task_size;
- m_tasks = tasks;
m_jacobian.newsize(task_size, dof);
m_jacobian = 0;
diff --git a/intern/iksolver/intern/IK_QJacobian.h b/intern/iksolver/intern/IK_QJacobian.h
index b80db1d8f53..3e20e4a9fd0 100644
--- a/intern/iksolver/intern/IK_QJacobian.h
+++ b/intern/iksolver/intern/IK_QJacobian.h
@@ -49,7 +49,7 @@ public:
~IK_QJacobian();
// Call once to initialize
- void ArmMatrices(int dof, int task_size, int tasks);
+ void ArmMatrices(int dof, int task_size);
void SetDoFWeight(int dof, MT_Scalar weight);
// Iteratively called
@@ -75,7 +75,7 @@ private:
void InvertSDLS();
void InvertDLS();
- int m_dof, m_task_size, m_tasks;
+ int m_dof, m_task_size;
bool m_transpose;
// the jacobian matrix and it's null space projector
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.cpp b/intern/iksolver/intern/IK_QJacobianSolver.cpp
index 7cfdcccc2ad..17750a7195f 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.cpp
+++ b/intern/iksolver/intern/IK_QJacobianSolver.cpp
@@ -30,9 +30,47 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
+#include <stdio.h>
#include "IK_QJacobianSolver.h"
+#include "MT_Quaternion.h"
//#include "analyze.h"
+IK_QJacobianSolver::IK_QJacobianSolver()
+{
+ m_poleconstraint = false;
+ m_getpoleangle = false;
+ m_rootmatrix.setIdentity();
+}
+
+MT_Scalar IK_QJacobianSolver::ComputeScale()
+{
+ std::vector<IK_QSegment*>::iterator seg;
+ float length = 0.0f;
+
+ for (seg = m_segments.begin(); seg != m_segments.end(); seg++)
+ length += (*seg)->MaxExtension();
+
+ if(length == 0.0f)
+ return 1.0f;
+ else
+ return 1.0f/length;
+}
+
+void IK_QJacobianSolver::Scale(float scale, std::list<IK_QTask*>& tasks)
+{
+ std::list<IK_QTask*>::iterator task;
+ std::vector<IK_QSegment*>::iterator seg;
+
+ for (task = tasks.begin(); task != tasks.end(); task++)
+ (*task)->Scale(scale);
+
+ for (seg = m_segments.begin(); seg != m_segments.end(); seg++)
+ (*seg)->Scale(scale);
+
+ m_rootmatrix.getOrigin() *= scale;
+ m_goal *= scale;
+ m_polegoal *= scale;
+}
void IK_QJacobianSolver::AddSegmentList(IK_QSegment *seg)
{
@@ -48,7 +86,7 @@ bool IK_QJacobianSolver::Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks)
m_segments.clear();
AddSegmentList(root);
- // assing each segment a unique id for the jacobian
+ // assign each segment a unique id for the jacobian
std::vector<IK_QSegment*>::iterator seg;
int num_dof = 0;
@@ -106,9 +144,9 @@ bool IK_QJacobianSolver::Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks)
}
// set matrix sizes
- m_jacobian.ArmMatrices(num_dof, primary_size, primary);
+ m_jacobian.ArmMatrices(num_dof, primary_size);
if (secondary > 0)
- m_jacobian_sub.ArmMatrices(num_dof, secondary_size, secondary);
+ m_jacobian_sub.ArmMatrices(num_dof, secondary_size);
// set dof weights
int i;
@@ -120,6 +158,109 @@ bool IK_QJacobianSolver::Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks)
return true;
}
+void IK_QJacobianSolver::SetPoleVectorConstraint(IK_QSegment *tip, MT_Vector3& goal, MT_Vector3& polegoal, float poleangle, bool getangle)
+{
+ m_poleconstraint = true;
+ m_poletip = tip;
+ m_goal = goal;
+ m_polegoal = polegoal;
+ m_poleangle = (getangle)? 0.0f: poleangle;
+ m_getpoleangle = getangle;
+}
+
+static MT_Scalar safe_acos(MT_Scalar f)
+{
+ // acos that does not return NaN with rounding errors
+ if (f <= -1.0f) return MT_PI;
+ else if (f >= 1.0f) return 0.0;
+ else return acos(f);
+}
+
+static MT_Vector3 normalize(const MT_Vector3& v)
+{
+ // a sane normalize function that doesn't give (1, 0, 0) in case
+ // of a zero length vector, like MT_Vector3.normalize
+ MT_Scalar len = v.length();
+ return MT_fuzzyZero(len)? MT_Vector3(0, 0, 0): v/len;
+}
+
+static float angle(const MT_Vector3& v1, const MT_Vector3& v2)
+{
+ return safe_acos(v1.dot(v2));
+}
+
+void IK_QJacobianSolver::ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks)
+{
+ // this function will be called before and after solving. calling it before
+ // solving gives predictable solutions by rotating towards the solution,
+ // and calling it afterwards ensures the solution is exact.
+
+ if(!m_poleconstraint)
+ return;
+
+ // disable pole vector constraint in case of multiple position tasks
+ std::list<IK_QTask*>::iterator task;
+ int positiontasks = 0;
+
+ for (task = tasks.begin(); task != tasks.end(); task++)
+ if((*task)->PositionTask())
+ positiontasks++;
+
+ if (positiontasks >= 2) {
+ m_poleconstraint = false;
+ return;
+ }
+
+ // get positions and rotations
+ root->UpdateTransform(m_rootmatrix);
+
+ const MT_Vector3 rootpos = root->GlobalStart();
+ const MT_Vector3 endpos = m_poletip->GlobalEnd();
+ const MT_Matrix3x3& rootbasis = root->GlobalTransform().getBasis();
+
+ // construct "lookat" matrices (like gluLookAt), based on a direction and
+ // an up vector, with the direction going from the root to the end effector
+ // and the up vector going from the root to the pole constraint position.
+ MT_Vector3 dir = normalize(endpos - rootpos);
+ MT_Vector3 rootx= rootbasis.getColumn(0);
+ MT_Vector3 rootz= rootbasis.getColumn(2);
+ MT_Vector3 up = rootx*cos(m_poleangle) + rootz*sin(m_poleangle);
+
+ // in post, don't rotate towards the goal but only correct the pole up
+ MT_Vector3 poledir = (m_getpoleangle)? dir: normalize(m_goal - rootpos);
+ MT_Vector3 poleup = normalize(m_polegoal - rootpos);
+
+ MT_Matrix3x3 mat, polemat;
+
+ mat[0] = normalize(MT_cross(dir, up));
+ mat[1] = MT_cross(mat[0], dir);
+ mat[2] = -dir;
+
+ polemat[0] = normalize(MT_cross(poledir, poleup));
+ polemat[1] = MT_cross(polemat[0], poledir);
+ polemat[2] = -poledir;
+
+ if(m_getpoleangle) {
+ // we compute the pole angle that to rotate towards the target
+ m_poleangle = angle(mat[1], polemat[1]);
+
+ if(rootz.dot(mat[1]*cos(m_poleangle) + mat[0]*sin(m_poleangle)) > 0.0f)
+ m_poleangle = -m_poleangle;
+
+ // solve again, with the pole angle we just computed
+ m_getpoleangle = false;
+ ConstrainPoleVector(root, tasks);
+ }
+ else {
+ // now we set as root matrix the difference between the current and
+ // desired rotation based on the pole vector constraint. we use
+ // transpose instead of inverse because we have orthogonal matrices
+ // anyway, and in case of a singular matrix we don't get NaN's.
+ MT_Transform trans(MT_Point3(0, 0, 0), polemat.transposed()*mat);
+ m_rootmatrix = trans*m_rootmatrix;
+ }
+}
+
bool IK_QJacobianSolver::UpdateAngles(MT_Scalar& norm)
{
// assing each segment a unique id for the jacobian
@@ -182,15 +323,20 @@ bool IK_QJacobianSolver::Solve(
const int max_iterations
)
{
+ float scale = ComputeScale();
+ bool solved = false;
//double dt = analyze_time();
- if (!Setup(root, tasks))
- return false;
+ Scale(scale, tasks);
+
+ ConstrainPoleVector(root, tasks);
+
+ root->UpdateTransform(m_rootmatrix);
// iterate
for (int iterations = 0; iterations < max_iterations; iterations++) {
// update transform
- root->UpdateTransform(MT_Transform::Identity());
+ root->UpdateTransform(m_rootmatrix);
std::list<IK_QTask*>::iterator task;
@@ -212,7 +358,7 @@ bool IK_QJacobianSolver::Solve(
m_jacobian.SubTask(m_jacobian_sub);
}
catch (...) {
- printf("IK Exception\n");
+ fprintf(stderr, "IK Exception\n");
return false;
}
@@ -231,12 +377,18 @@ bool IK_QJacobianSolver::Solve(
// check for convergence
if (norm < 1e-3) {
- //analyze_add_run(iterations, analyze_time()-dt);
- return true;
+ solved = true;
+ break;
}
}
+ if(m_poleconstraint)
+ root->PrependBasis(m_rootmatrix.getBasis());
+
+ Scale(1.0f/scale, tasks);
+
//analyze_add_run(max_iterations, analyze_time()-dt);
- return false;
+
+ return solved;
}
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.h b/intern/iksolver/intern/IK_QJacobianSolver.h
index adf95eb82dc..9ad46cd0aa6 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.h
+++ b/intern/iksolver/intern/IK_QJacobianSolver.h
@@ -43,6 +43,7 @@
#include <list>
#include "MT_Vector3.h"
+#include "MT_Transform.h"
#include "IK_QJacobian.h"
#include "IK_QSegment.h"
#include "IK_QTask.h"
@@ -50,11 +51,18 @@
class IK_QJacobianSolver
{
public:
- IK_QJacobianSolver() {};
+ IK_QJacobianSolver();
~IK_QJacobianSolver() {};
- // returns true if converged, false if max number of iterations was used
+ // setup pole vector constraint
+ void SetPoleVectorConstraint(IK_QSegment *tip, MT_Vector3& goal,
+ MT_Vector3& polegoal, float poleangle, bool getangle);
+ float GetPoleAngle() { return m_poleangle; };
+
+ // call setup once before solving, if it fails don't solve
+ bool Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks);
+ // returns true if converged, false if max number of iterations was used
bool Solve(
IK_QSegment *root,
std::list<IK_QTask*> tasks,
@@ -64,8 +72,11 @@ public:
private:
void AddSegmentList(IK_QSegment *seg);
- bool Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks);
bool UpdateAngles(MT_Scalar& norm);
+ void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks);
+
+ MT_Scalar ComputeScale();
+ void Scale(float scale, std::list<IK_QTask*>& tasks);
private:
@@ -75,6 +86,15 @@ private:
bool m_secondary_enabled;
std::vector<IK_QSegment*> m_segments;
+
+ MT_Transform m_rootmatrix;
+
+ bool m_poleconstraint;
+ bool m_getpoleangle;
+ MT_Vector3 m_goal;
+ MT_Vector3 m_polegoal;
+ float m_poleangle;
+ IK_QSegment *m_poletip;
};
#endif
diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp
index cf9e1615d8c..bf38c369363 100644
--- a/intern/iksolver/intern/IK_QSegment.cpp
+++ b/intern/iksolver/intern/IK_QSegment.cpp
@@ -61,11 +61,11 @@ static MT_Scalar EulerAngleFromMatrix(const MT_Matrix3x3& R, int axis)
MT_Scalar t = sqrt(R[0][0]*R[0][0] + R[0][1]*R[0][1]);
if (t > 16.0*MT_EPSILON) {
- if (axis == 0) return atan2(R[1][2], R[2][2]);
+ if (axis == 0) return -atan2(R[1][2], R[2][2]);
else if(axis == 1) return atan2(-R[0][2], t);
- else return atan2(R[0][1], R[0][0]);
+ else return -atan2(R[0][1], R[0][0]);
} else {
- if (axis == 0) return atan2(-R[2][1], R[1][1]);
+ if (axis == 0) return -atan2(-R[2][1], R[1][1]);
else if(axis == 1) return atan2(-R[0][2], t);
else return 0.0f;
}
@@ -236,6 +236,18 @@ IK_QSegment::IK_QSegment(int num_DoF, bool translational)
m_orig_translation = m_translation;
}
+void IK_QSegment::Reset()
+{
+ m_locked[0] = m_locked[1] = m_locked[2] = false;
+
+ m_basis = m_orig_basis;
+ m_translation = m_orig_translation;
+ SetBasis(m_basis);
+
+ for (IK_QSegment *seg = m_child; seg; seg = seg->m_sibling)
+ seg->Reset();
+}
+
void IK_QSegment::SetTransform(
const MT_Vector3& start,
const MT_Matrix3x3& rest_basis,
@@ -326,6 +338,21 @@ void IK_QSegment::UpdateTransform(const MT_Transform& global)
seg->UpdateTransform(m_global_transform);
}
+void IK_QSegment::PrependBasis(const MT_Matrix3x3& mat)
+{
+ m_basis = m_rest_basis.inverse() * mat * m_rest_basis * m_basis;
+}
+
+void IK_QSegment::Scale(float scale)
+{
+ m_start *= scale;
+ m_translation *= scale;
+ m_orig_translation *= scale;
+ m_global_start *= scale;
+ m_global_transform.getOrigin() *= scale;
+ m_max_extension *= scale;
+}
+
// IK_QSphericalSegment
IK_QSphericalSegment::IK_QSphericalSegment()
@@ -1009,3 +1036,17 @@ void IK_QTranslateSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
m_limit[axis]= true;
}
+void IK_QTranslateSegment::Scale(float scale)
+{
+ int i;
+
+ IK_QSegment::Scale(scale);
+
+ for (i = 0; i < 3; i++) {
+ m_min[0] *= scale;
+ m_max[1] *= scale;
+ }
+
+ m_new_translation *= scale;
+}
+
diff --git a/intern/iksolver/intern/IK_QSegment.h b/intern/iksolver/intern/IK_QSegment.h
index e406585bc8b..3c5df463468 100644
--- a/intern/iksolver/intern/IK_QSegment.h
+++ b/intern/iksolver/intern/IK_QSegment.h
@@ -165,6 +165,13 @@ public:
virtual void SetBasis(const MT_Matrix3x3& basis) { m_basis = basis; }
+ // functions needed for pole vector constraint
+ void PrependBasis(const MT_Matrix3x3& mat);
+ void Reset();
+
+ // scale
+ virtual void Scale(float scale);
+
protected:
// num_DoF: number of degrees of freedom
@@ -331,6 +338,8 @@ public:
void SetWeight(int axis, MT_Scalar weight);
void SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax);
+ void Scale(float scale);
+
private:
int m_axis[3];
bool m_axis_enabled[3], m_limit[3];
diff --git a/intern/iksolver/intern/IK_QTask.h b/intern/iksolver/intern/IK_QTask.h
index 0e00925d908..f2fd34119a1 100644
--- a/intern/iksolver/intern/IK_QTask.h
+++ b/intern/iksolver/intern/IK_QTask.h
@@ -75,6 +75,10 @@ public:
virtual MT_Scalar Distance() const=0;
+ virtual bool PositionTask() const { return false; }
+
+ virtual void Scale(float scale) {}
+
protected:
int m_id;
int m_size;
@@ -97,6 +101,9 @@ public:
MT_Scalar Distance() const;
+ bool PositionTask() const { return true; }
+ void Scale(float scale) { m_goal *= scale; m_clamp_length *= scale; }
+
private:
MT_Vector3 m_goal;
MT_Scalar m_clamp_length;
@@ -133,6 +140,8 @@ public:
MT_Scalar Distance() const;
+ void Scale(float scale) { m_goal_center *= scale; m_distance *= scale; }
+
private:
MT_Scalar ComputeTotalMass(const IK_QSegment *segment);
MT_Vector3 ComputeCenter(const IK_QSegment *segment);
diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp
index 919eeb739ce..140c35c8c46 100644
--- a/intern/iksolver/intern/IK_Solver.cpp
+++ b/intern/iksolver/intern/IK_Solver.cpp
@@ -41,7 +41,7 @@ using namespace std;
class IK_QSolver {
public:
- IK_QSolver() {};
+ IK_QSolver() : root(NULL) {};
IK_QJacobianSolver solver;
IK_QSegment *root;
@@ -197,13 +197,12 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
if (stiffness < 0.0)
return;
- if (stiffness > 0.99)
- stiffness = 0.99;
+ if (stiffness > 0.999)
+ stiffness = 0.999;
IK_QSegment *qseg = (IK_QSegment*)seg;
MT_Scalar weight = 1.0-stiffness;
-
if (axis >= IK_TRANS_X) {
if(!qseg->Translational())
if(qseg->Composite() && qseg->Composite()->Translational())
@@ -318,6 +317,31 @@ void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[
qsolver->tasks.push_back(orient);
}
+void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle)
+{
+ if (solver == NULL || tip == NULL)
+ return;
+
+ IK_QSolver *qsolver = (IK_QSolver*)solver;
+ IK_QSegment *qtip = (IK_QSegment*)tip;
+
+ MT_Vector3 qgoal(goal);
+ MT_Vector3 qpolegoal(polegoal);
+
+ qsolver->solver.SetPoleVectorConstraint(
+ qtip, qgoal, qpolegoal, poleangle, getangle);
+}
+
+float IK_SolverGetPoleAngle(IK_Solver *solver)
+{
+ if (solver == NULL)
+ return 0.0f;
+
+ IK_QSolver *qsolver = (IK_QSolver*)solver;
+
+ return qsolver->solver.GetPoleAngle();
+}
+
void IK_SolverAddCenterOfMass(IK_Solver *solver, IK_Segment *root, float goal[3], float weight)
{
if (solver == NULL || root == NULL)
@@ -346,6 +370,9 @@ int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations)
std::list<IK_QTask*>& tasks = qsolver->tasks;
MT_Scalar tol = tolerance;
+ if(!jacobian.Setup(root, tasks))
+ return 0;
+
bool result = jacobian.Solve(root, tasks, tol, max_iterations);
return ((result)? 1: 0);
diff --git a/intern/iksolver/intern/TNT/svd.h b/intern/iksolver/intern/TNT/svd.h
index af281d0fce0..9ca51fa2650 100644
--- a/intern/iksolver/intern/TNT/svd.h
+++ b/intern/iksolver/intern/TNT/svd.h
@@ -18,11 +18,13 @@
#include "tntmath.h"
+#define SVD_MAX_ITER 200
+
namespace TNT
{
template <class MaTRiX, class VecToR >
-void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2) {
+void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work2, int maxiter=SVD_MAX_ITER) {
int m = A.num_rows();
int n = A.num_cols();
@@ -216,7 +218,10 @@ void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work
int kase=0;
k=0;
- // Here is where a test for too many iterations would go.
+ // Test for maximum iterations to avoid infinite loop
+ if(maxiter == 0)
+ break;
+ maxiter--;
// This section of the program inspects for
// negligible elements in the s and e arrays. On
diff --git a/intern/keymaker/Makefile b/intern/keymaker/Makefile
deleted file mode 100644
index 703482a851b..00000000000
--- a/intern/keymaker/Makefile
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# $Id$
-# ***** BEGIN GPL/BL DUAL 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. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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): Hans Lambermont
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-# blender keyreader-library makefile
-#
-
-LIBNAME = blenkey
-SOURCEDIR = intern/$(LIBNAME)
-DIR = $(OCGDIR)/$(SOURCEDIR)
-CSRCS = mt19937int.c key.c
-
-ALLTARGETS = $(OBJS)
-
-include nan_compile.mk
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-CPPFLAGS += -I$(NAN_OPENSSL)/include -Ipython/
-
-include nan_link.mk
-
-# OBJS is for the library, set by nan_compile.mk
-LOADER_OBJS = $(DIR)/$(DEBUG_DIR)keyloader.o
-
-ifneq ($(OS),windows)
- LIBS = $(NAN_OPENSSL)/lib/libcrypto.a
-else
- ifeq ($(FREE_WINDOWS),true)
- LIBS = $(NAN_OPENSSL)/lib/libcrypto.a
- else
- LIBS = $(NAN_OPENSSL)/lib/libeay32.lib
- LIBS += advapi32.lib gdi32.lib
- endif
-endif
-
-all debug:: link
-
-link: $(DIR)/$(DEBUG_DIR)keyloader
-
-strip:
- ifneq ($(OS),windows)
- strip keyloader
- @ls -la keyloader
- else
- @ls -la keyloader.exe
- endif
-
-install: all debug
- @[ -d $(LCGDIR)/$(LIBNAME) ] || mkdir $(LCGDIR)/$(LIBNAME)
- @[ -d $(LCGDIR)/$(LIBNAME)/include ] || mkdir $(LCGDIR)/$(LIBNAME)/include
- @[ -d $(LCGDIR)/$(LIBNAME)/lib ] || mkdir $(LCGDIR)/$(LIBNAME)/lib
- @../tools/cpifdiff.sh blenkey.h $(LCGDIR)/$(LIBNAME)/include/
- @../tools/cpifdiff.sh $(LIB_a) $(LCGDIR)/$(LIBNAME)/lib/
-ifeq ($(OS),darwin)
- ranlib $(LCGDIR)/$(LIBNAME)/lib/lib$(LIBNAME).a
-endif
-
-$(DIR)/$(DEBUG_DIR)keyloader: $(LOADER_OBJS) $(LIB_a)
- $(CC) $(LDFLAGS) -o $@ $(LOADER_OBJS) $(LIB_a) $(LIBS)
-
-clean::
- $(RM) $(DIR)/key* $(DIR)/debug/key*
- $(RM) $(DIR)/nan* $(DIR)/debug/nan*
-
-tags:
- etags *.c *.h
diff --git a/intern/keymaker/blenkey.h b/intern/keymaker/blenkey.h
deleted file mode 100644
index e504fdf62b8..00000000000
--- a/intern/keymaker/blenkey.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Blender Key loader library external interface
- */
-
-#ifndef BLENKEY_H
-#define BLENKEY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned char byte;
-
-typedef struct UserStructType {
- char name[100];
- char email[100];
- char shopid[100];
- unsigned long reldate;
- int keytype; /* 1 = Individual, 2 = Corporate, 3 = Unlimited */
- int keylevel; /* key disclosure level, starts at 1 */
- int keyformat; /* if we change the keyformat, up BLENKEYFORMAT */
-} UserStruct;
-
-char *Hexify(byte *in, unsigned int length);
-byte *DeHexify(char *in);
-
-byte checkfunc0(byte a, byte b);
-byte checkfunc1(byte a, byte b);
-byte checkfunc2(byte a, byte b);
-byte checkfunc3(byte a, byte b);
-byte checkfunc4(byte a, byte b);
-
-/* the byte size of the checksum datablock
-#define MAXBYTEDATABLOCK 1000 */
-
-#define BLENKEYMAGIC "0ce0ba52"
-#define BLENKEYSEPERATOR "---+++---"
-#define BLENKEYFORMAT 1
-
-
-int ReadKeyFile(char *filename, UserStruct *User,
- char **Priv, char **Pub, byte **Byte, char **Python);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLENKEY_H */
-
diff --git a/intern/keymaker/key.c b/intern/keymaker/key.c
deleted file mode 100644
index 413ee8b448c..00000000000
--- a/intern/keymaker/key.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/* ex:ts=4 */
-
-/**
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Blender Key loader library
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "blenkey.h" /* external interface */
-#include "key_internal.h"
-
-char *Hexify(byte *in, unsigned int length) {
- unsigned int i;
- char Tstring[3];
- char *out = malloc((2*length + 1) * sizeof(char));
- sprintf(out, "%02X", in[0]);
- for (i=1; i<length; i++) {
- sprintf(Tstring, "%02X", in[i]);
- strcat(out, Tstring);
- }
- return (out);
-}
-
-byte *DeHexify(char *in) {
- size_t len = strlen(in);
- byte *out = malloc((len/2) * sizeof(byte));
- unsigned int hexedbyte;
- unsigned int i;
- char *inp = in;
- byte *outp = out;
- for (i=0; i<(len/2); i++) {
- sscanf(inp, "%2x", &hexedbyte);
- inp += 2;
- *outp = (byte) hexedbyte;
- outp++;
- }
- /* printf("\nlen=%d, string=[%s]\n", len, Hexify(out, len/2)); */
- return (out);
-}
-
-int from_hex(char c) {
- return (c<'A') ? (c-'0') : (c-'A'+10);
-}
-
-/* 5 ReadHex helper functions ------------------------------------------
- read one Hex byte (two characters) and skip newlines if necessary */
-byte ReadHexByteFp(FILE *fh, int *newlinetracker) {
- unsigned char a;
- unsigned char a1, a2;
- /* read 2 bytes hexcode of ascii data type */
- fread(&a1, 1, 1, fh);
- fread(&a2, 1, 1, fh);
- a = 16 * (from_hex(a1)) + (from_hex(a2));
- /*printf("Char[%d] = %02X\n", *newlinetracker, a); */
- *newlinetracker += 2;
- /* skip the newlines */
- if (*newlinetracker == 72) {
- fseek(fh, 1, SEEK_CUR);
- *newlinetracker = 0;
- /*printf("LastChar = %02X\n", a); */
- }
- return((byte) a);
-}
-byte ReadHexByteCp(char **from) {
- int a;
- /* read 2 bytes hexcode of ascii data type */
- sscanf(*from, "%2x", &a);
- /*printf("Char = %02X\n", a); */
- *from += 2;
- return((byte) a);
-}
-/* Generic hex2int */
-int HexToInt(int a) {
- if (a == 0x20) /* space, count as 0 ;-) */
- return 0;
- else
- return(a - '0');
-}
-/* Note: this is only to be used for the header type */
-int HexToIntFp(FILE *fh, int *newlinetracker) {
- byte a = ReadHexByteFp(fh, newlinetracker);
- if (DEBUG) printf("%02X = %d\n", a, a); /* note: no HexToInt here */
- return(a);
-}
-int HexToIntCp(char **from) {
- byte a = ReadHexByteCp(from);
- if (DEBUG) printf("%02X = %d\n", a, a); /* note: no HexToInt here */
- return(a);
-}
-/* Note: this is only to be used for the header length */
-int Hex5ToInt(byte a, byte b, byte c, byte d, byte e) {
- return(HexToInt((int) a) * 10000 +
- HexToInt((int) b) * 1000 +
- HexToInt((int) c) * 100 +
- HexToInt((int) d) * 10 +
- HexToInt((int) e));
-}
-/* Note: this is only to be used for the header length */
-int Hex5ToIntFp(FILE *fh, int *newlinetracker) {
- byte a = ReadHexByteFp(fh, newlinetracker),
- b = ReadHexByteFp(fh, newlinetracker),
- c = ReadHexByteFp(fh, newlinetracker),
- d = ReadHexByteFp(fh, newlinetracker),
- e = ReadHexByteFp(fh, newlinetracker);
- if (DEBUG) printf("\n%02X%02X%02X%02X%02X = %d\n", a, b, c, d, e,
- Hex5ToInt(a, b, c, d, e));
- return(Hex5ToInt(a, b, c, d, e));
-}
-int Hex5ToIntCp(char **from) {
- byte a = ReadHexByteCp(from),
- b = ReadHexByteCp(from),
- c = ReadHexByteCp(from),
- d = ReadHexByteCp(from),
- e = ReadHexByteCp(from);
- if (DEBUG) printf("\n%02X%02X%02X%02X%02X = %d\n", a, b, c, d, e,
- Hex5ToInt(a, b, c, d, e));
- return(Hex5ToInt(a, b, c, d, e));
-}
-/* --------------------------------------------------------------------- */
-
-/* return the biggest */
-byte checkfunc0(byte a, byte b) {
- if (a > b) return a;
- else return b;
-}
-/* return |a-b| */
-byte checkfunc1(byte a, byte b) {
- if (a > b) return a - b;
- else return b - a;
-}
-/* return the sum mod 256 */
-byte checkfunc2(byte a, byte b) {
- return ((a + b) % 256);
-}
-/* return the multiplication mod 256 */
-byte checkfunc3(byte a, byte b) {
- return ((a * b) % 256);
-}
-/* return a/b or 0 */
-byte checkfunc4(byte a, byte b) {
- if (b != 0) return (a / b);
- else return 0;
-}
-
-char *scan_ascii(FILE *fh, UserStruct *User) {
- long ascii_size;
- char *ascii_data = NULL;
- char *mdhex = NULL;
- byte md[RIPEMD160_DIGEST_LENGTH];
- char string[1024];
- char dosnewlines = 0;
- int lines = 0;
- int oldftell;
-
- /* NOTE: fscanf is notorious for its buffer overflows. This must be
- fixed some day, consider this a proof-of-concept version. */
-
- fscanf(fh, "%1000[^\n]", string);
- sscanf(string, "%*s %s %s %lu %d %d %d",
- User->email,
- User->shopid,
- &User->reldate,
- &User->keytype,
- &User->keylevel,
- &User->keyformat);
-
- if (User->keyformat <= BLENKEYFORMAT) {
- if (DEBUG) printf(
- "Email:[%s] ShopID:[%s] RelDate:[%lu] KeyType[%d] KeyLevel[%d]\n",
- User->email, User->shopid, User->reldate, User->keytype,
- User->keylevel);
-
- /* read /n/n
- check if we're reading dow newlines...
- */
- oldftell = ftell(fh);
- getc(fh);
- if ((ftell(fh) - oldftell) == 2) {
- /* yes ! */
- dosnewlines = 1;
- }
- getc(fh);
-
- fscanf(fh, "%1000[^\n]", string);
- strncpy(User->name, string, sizeof(User->name) - 1);
-
- if (DEBUG) printf("Name:[%s]\n", User->name);
-
- getc(fh);
-
- /* 4 lines read uptil now... */
- lines = 4;
-
- while (getc(fh) != EOF) {
- fscanf(fh, "%1000[^\n]", string);
- lines++;
- /* if (DEBUG) printf("%s\n", string); */
- if (strcmp(string, BLENKEYSEPERATOR) == 0) {
- getc(fh);
- break;
- }
- }
-
- /* fh now points at the start of the datablock */
- ascii_size = ftell(fh);
-
- if (dosnewlines) {
- /* if we were reading on dos
- ftell will also count the ^M 's in the file;
- substract them
- */
- ascii_size -= lines;
- }
-
- ascii_data = malloc((ascii_size+1) * sizeof(char));
- fseek(fh, 0, SEEK_SET);
- fread(ascii_data, sizeof(char), ascii_size, fh);
- ascii_data[ascii_size] = '\0';
-
- if (DEBUG)
- printf("asciiblock is %ld bytes long:\n[%s]\n", ascii_size, ascii_data);
-
- /* calculate the hash checksum */
- RIPEMD160(ascii_data, ascii_size, md);
- free(ascii_data);
- mdhex = Hexify(md, RIPEMD160_DIGEST_LENGTH);
- }
-
- return(mdhex);
-}
-
-char *ReadHexCryptedData(FILE *fh, int *newlinetracker) {
- int HexCryptedDataLength = Hex5ToIntFp(fh, newlinetracker);
- int DataType = HexToIntFp(fh, newlinetracker);
- char *HexCryptedData = malloc((HexCryptedDataLength+1) * sizeof(char));
- int i;
-
- if (DataType != 1) {
- /* printf("Error: unexpected datatype for HexCryptedData\n"); */
- free(HexCryptedData);
- HexCryptedData = 0;
- } else {
- for (i=0; i<(HexCryptedDataLength/2); i++) {
- sprintf(HexCryptedData+2*i, "%02X", ReadHexByteFp(fh, newlinetracker));
- }
- }
-
- return(HexCryptedData);
-}
-
-char *ReadHexCryptedKey(FILE *fh, int *newlinetracker) {
- int HexCryptedKeyLength = Hex5ToIntFp(fh, newlinetracker);
- int DataType = HexToIntFp(fh, newlinetracker);
- char *HexCryptedKey = malloc((HexCryptedKeyLength+1) * sizeof(char));
- int i;
-
- if (DataType != 2) {
- /* printf("Error: unexpected datatype for HexCryptedKey\n"); */
- free(HexCryptedKey);
- HexCryptedKey = 0;
- } else {
- for (i=0; i<(HexCryptedKeyLength/2); i++) {
- sprintf(HexCryptedKey+2*i, "%02X", ReadHexByteFp(fh, newlinetracker));
- }
- }
-
- return(HexCryptedKey);
-}
-
-/* NOTE: CHANGE THIS INTO A KEY OF OUR OWN */
-void LoadRSApubKey(RSA *Pub) {
- static unsigned char n[] =
-"\xD1\x12\x0C\x6A\x34\x0A\xCF\x4C\x6B\x34\xA9\x3C\xDD\x1A\x2A\x68"
-"\x34\xE5\xB4\xA2\x08\xE8\x9F\xCE\x76\xEF\x4B\x92\x9B\x99\xB4\x57"
-"\x72\x95\x78\x1D\x9E\x21\x1B\xF9\x5C\x1B\x0E\xC9\xD0\x89\x75\x28"
-"\x08\x13\x6A\xD8\xA9\xC2\xA4\x31\x91\x53\x5A\xB9\x26\x71\x8C\x05";
- static unsigned char e[] =
-"\x01\x00\x01";
-/*
- static unsigned char e[] = "\x11";
- static unsigned char n[] =
-"\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F"
-"\x90\xEF\xA0\x0D\xF3\x77\x4A\x25\x9F\x2E\x62\xB4\xC5\xD9\x9C\xB5"
-"\xAD\xB3\x00\xA0\x28\x5E\x53\x01\x93\x0E\x0C\x70\xFB\x68\x76\x93"
-"\x9C\xE6\x16\xCE\x62\x4A\x11\xE0\x08\x6D\x34\x1E\xBC\xAC\xA0\xA1"
-"\xF5";
-*/
-
- Pub->e = BN_bin2bn(e, sizeof(e)-1, Pub->e);
- Pub->n = BN_bin2bn(n, sizeof(n)-1, Pub->n);
-}
-
-byte *RSADecryptKey(char *HexCryptedKey) {
- byte *CryptedKey = NULL;
- byte *Key = NULL;
- int KeyLen;
- int CryptedKeyLen = strlen(HexCryptedKey)/2;
- RSA *Pub = NULL;
-
- /* Load RSA public key */
- Pub = RSA_new();
- if (Pub == NULL) {
- /* printf("Error in RSA_new\n"); */
- } else {
- LoadRSApubKey(Pub);
-
- Key = malloc(RSA_size(Pub) * sizeof(byte));
-
- CryptedKey = DeHexify(HexCryptedKey);
-
- KeyLen = RSA_public_decrypt(CryptedKeyLen, CryptedKey, Key, Pub,
- RSA_PKCS1_PADDING);
- if (DEBUG)
- printf("CryptedKeyLen = %d, KeyLen = %d\n", CryptedKeyLen, KeyLen);
- if (KeyLen == -1) {
-#ifndef NDEBUG
- printf("Error in RSA_public_decrypt: %s\n", ERR_error_string(ERR_get_error(), NULL));
-#endif
- free(Key);
- Key = NULL;
- }
- }
-
- return (Key);
-}
-
-char *DeCryptDatablock(byte *CryptKey, int keylen, char *HexCryptedData) {
- RC4_KEY key;
- byte *CryptedData = DeHexify(HexCryptedData);
- unsigned int datalen = strlen(HexCryptedData)/2;
- char *KeyDataString = malloc(datalen * sizeof(char));
-
- RC4_set_key(&key, keylen, CryptKey);
- RC4(&key, datalen, CryptedData, KeyDataString);
- free(CryptedData);
-
- return(KeyDataString);
-}
-
-char *get_from_datablock(char **DataPtr, char *TypeString) {
- int tstringsize = Hex5ToIntCp(DataPtr);
- int tstringtype = HexToIntCp(DataPtr);
- char *HexString = NULL;
-
- if (atoi(TypeString) != tstringtype) {
- /* printf("Unexpected type %d, expected %s\n", tstringtype, TypeString); */
- } else {
- HexString = malloc((tstringsize+1) * sizeof(char));
-
- strncpy(HexString, *DataPtr, tstringsize);
- *DataPtr += tstringsize;
- HexString[tstringsize] = '\0';
- }
-
- return(HexString);
-}
-
-int ReadKeyFile(char *filename, UserStruct *User,
- char **Priv, char **Pub, byte **Byte, char **Python) {
- FILE *rawkeyfile;
- char *HexAsciiHash = NULL, *HexCryptedData = NULL, *HexCryptedKey =
- NULL;
- int newlinetracker = 0; /* line position, counts from 0-71 */
- byte *CryptKey = NULL;
- char *KeyDataString = NULL;
- char *KeyDataPtr = NULL;
- char *HexByte = NULL;
- char *mdhex = NULL;
- int ret_val = 1;
-
- if ((rawkeyfile = fopen(filename, "rb")) == NULL) {
- /* printf("error, cannot read %s\n", filename); */
- } else {
- /* Scan and interpret the ASCII part */
- HexAsciiHash = scan_ascii(rawkeyfile, User);
- if (DEBUG) printf("\nHexHash: %s\n", HexAsciiHash);
-
- /* Read the HexCryptedData */
- HexCryptedData = ReadHexCryptedData(rawkeyfile, &newlinetracker);
- if (DEBUG) printf("\nHexCryptedData: %s\n", HexCryptedData);
-
- /* Read the HexCryptedKey */
- HexCryptedKey = ReadHexCryptedKey(rawkeyfile, &newlinetracker);
- if (DEBUG) printf("\nHexCryptedKey: %s\n", HexCryptedKey);
-
- /* close keyfile */
- fclose(rawkeyfile);
-
- if (HexAsciiHash && HexCryptedKey && HexCryptedData) {
- /* Decrypt HexCryptedKey */
- CryptKey = RSADecryptKey(HexCryptedKey);
-
- if (CryptKey) {
- /* Decrypt HexCryptedData */
- KeyDataString = DeCryptDatablock(CryptKey, 16, HexCryptedData);
- free(CryptKey);
- CryptKey = NULL;
-
- if (KeyDataString) {
- if (DEBUG) printf("\nKeyDataString: %s\n", KeyDataString);
-
- /* Extract data from KeyDataString */
- KeyDataPtr = KeyDataString;
- mdhex = get_from_datablock(&KeyDataPtr, "01");
- *Priv = get_from_datablock(&KeyDataPtr, "02");
- *Pub = get_from_datablock(&KeyDataPtr, "03");
- HexByte = get_from_datablock(&KeyDataPtr, "04");
- if (HexByte) {
- *Byte = DeHexify(HexByte);
- free(HexByte);
- HexByte = NULL;
-
- *Python = get_from_datablock(&KeyDataPtr, "05");
-
- /* Check ascii hash */
- if (strcmp(mdhex, HexAsciiHash) != 0) {
- /* printf("Ascii part checksums do not match !\n");
- printf("found: %s\n", mdhex);
- printf("check: %s\n", HexAsciiHash);
- */
- ret_val = 2;
- } else {
- if (DEBUG) printf("\nThe ascii part checksum matches\n");
- /* everything ok ! */
- ret_val = 0;
- }
- free(mdhex);
- mdhex = NULL;
- }
-
- free(KeyDataString);
- KeyDataString = NULL;
- }
- }
- }
-
- /* cleanup */
-
- if (HexAsciiHash) {
- free(HexAsciiHash);
- HexAsciiHash = NULL;
- }
-
- if (HexCryptedKey) {
- free(HexCryptedKey);
- HexCryptedKey = NULL;
- }
-
- if (HexCryptedData) {
- free(HexCryptedData);
- HexCryptedData = NULL;
- }
- }
-
- return (ret_val);
-}
-
diff --git a/intern/keymaker/key_internal.h b/intern/keymaker/key_internal.h
deleted file mode 100644
index 2bd60b9e9d8..00000000000
--- a/intern/keymaker/key_internal.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/* ex:ts=4 */
-
-/**
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Blender Key loader library internal stuff
- */
-
-#include "openssl/rand.h"
-#include "openssl/rsa.h"
-#include "openssl/ripemd.h"
-#include "openssl/rc4.h"
-#include "openssl/err.h"
-#include "blenkey.h"
-
-#include "mt19937int.h" /* Mersenne Twister (under artistic license) */
-
-#define MAXASCIIBLOCK 1000
-#define MAXBYTEDATABLOCK 1000
-
-#ifdef NDEBUG
- #define DEBUG 0
-#else
- #define DEBUG 1
-#endif
-
-/* keyloader and keymaker internal prototypes */
-int from_hex(char c);
-byte ReadHexByteFp(FILE *fh, int *newlinetracker);
-byte ReadHexByteCp(char **from);
-int HexToInt(int a);
-int HexToIntFp(FILE *fh, int *newlinetracker);
-int HexToIntCp(char **from);
-int Hex5ToInt(byte a, byte b, byte c, byte d, byte e);
-int Hex5ToIntFp(FILE *fh, int *newlinetracker);
-int Hex5ToIntCp(char **from);
-void pub_priv_test(char *HexPriv, char *HexPub);
-int main(int argc, char **argv);
-
-/* keyloader only internal prototypes */
-char *scan_ascii(FILE *fh, UserStruct *User);
-char *ReadHexCryptedData(FILE *fh, int *newlinetracker);
-char *ReadHexCryptedKey(FILE *fh, int *newlinetracker);
-void LoadRSApubKey(RSA *Pub);
-byte *RSADecryptKey(char *HexCryptedKey);
-char *DeCryptDatablock(byte *CryptKey, int keylen, char *HexCryptedData);
-char *get_from_datablock(char **DataPtr, char *TypeString);
-int Check_All_Byte_Calculus_Data(char *KeyBytePtr);
-
-/* keymaker only internal prototypes */
-void usage(void);
-char *Create_Ascii_Part(int argc, char **argv);
-void Create_User_RSA_Keys(unsigned int keylength,
- char **rsaPrivString, char **rsaPubString);
-char *Create_Byte_Calculus_Data(void);
-byte *CreateCryptKey(unsigned int size);
-char *CryptDatablock(byte *CryptKey, int keylen, char *KeyDataString);
-char *RSACryptKey(RSA *rsa, byte *CryptKey, int KeyLen);
-void add_to_datablock(char **DataString, char *HexString, char *TypeString);
-void LoadRSAprivKey(RSA *Priv);
-
diff --git a/intern/keymaker/keyloader.c b/intern/keymaker/keyloader.c
deleted file mode 100644
index 878ed319cb5..00000000000
--- a/intern/keymaker/keyloader.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/* ex:ts=4 */
-
-/**
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Blender Key Read-tester
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "key_pyc.h" /* the Python byte code */
-#include "blenkey.h" /* the external interface */
-#include "key_internal.h"
-
-#define TESTReadKeyFile 1
-
-int Check_All_Byte_Calculus_Data(char *KeyBytePtr) {
- int i;
-
- /* create some unique number arrays */
- int NoRealRandomArray[MAXBYTEDATABLOCK];
-
- typedef byte (*funcpoin)(byte, byte);
- funcpoin checkfunc[] = {&checkfunc0, &checkfunc1, &checkfunc2,
- &checkfunc3, &checkfunc4};
-
- byte *KeyByteData = DeHexify(KeyBytePtr);
-
- /* first create a fixed seed random number generator */
- sgenrand(666); /* seed it fixed */
-
- /* initialize arrays with unique numbers */
- for (i=0; i<MAXBYTEDATABLOCK; i++) {
- NoRealRandomArray[i] = i;
- }
- /* then stir the unique number lists */
- for (i=0; i<MAXBYTEDATABLOCK; i++) {
- unsigned long randswap = genrand();
- int swap1 = (int) (randswap % MAXBYTEDATABLOCK);
- int swap2 = (int) ((randswap>>16) % MAXBYTEDATABLOCK);
- int store = NoRealRandomArray[swap1];
- /* printf("%lu %d %d\n", randswap, swap1, swap2); */
- NoRealRandomArray[swap1] = NoRealRandomArray[swap2];
- NoRealRandomArray[swap2] = store;
- }
- if (DEBUG) {
- printf("\nFixed seed unique number random data: ");
- for (i=0; i<MAXBYTEDATABLOCK; i++) {
- printf("%d ", NoRealRandomArray[i]);
- }
- printf("\n\n");
- }
-
- /* check our byte calculus functions on the random data */
- for (i=0; i<(MAXBYTEDATABLOCK-3); i+=3) {
- if (DEBUG) {
- char *Pcheckfunc[] = {"max", " - ", " + ", " * ", " / "};
- printf("[%3d]=[%3d]%s[%3d] ",
- NoRealRandomArray[i], NoRealRandomArray[i+1],
- Pcheckfunc[NoRealRandomArray[i]%5], NoRealRandomArray[i+2]);
- printf("%3d%s%3d: %3d == %3d\n",
- KeyByteData[NoRealRandomArray[i+1]],
- Pcheckfunc[NoRealRandomArray[i]%5],
- KeyByteData[NoRealRandomArray[i+2]],
- KeyByteData[NoRealRandomArray[i]],
- checkfunc[(NoRealRandomArray[i]%5)](
- KeyByteData[NoRealRandomArray[i+1]],
- KeyByteData[NoRealRandomArray[i+2]]));
- }
- if (KeyByteData[NoRealRandomArray[i]] !=
- checkfunc[(NoRealRandomArray[i]%5)](
- KeyByteData[NoRealRandomArray[i+1]],
- KeyByteData[NoRealRandomArray[i+2]])) {
- printf("\nByte Checksum failed !\n");
- return (1);
- }
- }
- return (0);
-}
-
-void pub_priv_test(char *HexPriv, char *HexPub)
-{
- RSA *rsa = NULL;
- /* static unsigned char rsa_e[] = "\x11"; */
- static unsigned char rsa_e[] = "\x01\x00\x01";
- byte cryptKey[16];
- byte *cryptedKey;
- byte *pubKey, *privKey;
- int pubKeyLen, privKeyLen;
- int deCryptKeyLen;
- unsigned char *deCryptKey;
- int cryptKeyLen = 16;
- int cryptedKeyLen;
-
- strcpy(cryptKey, "abcdefghijklmno");
-
- pubKey = DeHexify(HexPub);
- pubKeyLen = strlen(HexPub) / 2;
-
- privKey = DeHexify(HexPriv);
- privKeyLen = strlen(HexPriv) / 2;
-
- rsa = RSA_new();
- if (rsa == NULL) {
- fprintf(stderr, "Error in RSA_new\n");
- exit(1);
- }
- rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
- rsa->n = BN_bin2bn(pubKey, pubKeyLen, rsa->n);
- rsa->d = BN_bin2bn(privKey, privKeyLen, rsa->d);
-
- fprintf(stderr, "NOTE e %d, n %d, d %d rsa_size %d\n",
- sizeof(rsa_e)-1, pubKeyLen, privKeyLen, RSA_size(rsa));
-
- cryptedKey = malloc(RSA_size(rsa) * sizeof(byte));
- cryptedKeyLen = RSA_private_encrypt(cryptKeyLen, cryptKey,
- cryptedKey, rsa, RSA_PKCS1_PADDING);
-
- deCryptKey = malloc(RSA_size(rsa) * sizeof(unsigned char));
- deCryptKeyLen = RSA_public_decrypt(cryptedKeyLen, cryptedKey,
- deCryptKey, rsa, RSA_PKCS1_PADDING);
- if (deCryptKeyLen == -1) {
- printf("Error in RSA_public_decrypt: %s\n",
- ERR_error_string(ERR_get_error(), NULL));
- exit(1);
- } else {
- printf("RSA_public_decrypt test SUCCEEDED\n");
- }
-
-}
-
-#ifdef TESTReadKeyFile
-int main(int argc, char **argv) {
- int result;
- UserStruct User;
- char *HexPriv = NULL, *HexPub = NULL, *HexPython = NULL;
- byte *Byte = NULL;
- byte *PythonData = NULL;
- int PythonLength;
- char *HexByte = NULL;
-
- if (argc != 2) {
- printf("usage: %s keyfile\n", argv[0]);
- exit(1);
- }
-
- result = ReadKeyFile(argv[1], &User, &HexPriv, &HexPub, &Byte, &HexPython);
- if (result != 0) {
- printf("\nReadKeyFile error %d\n", result);
- exit(result);
- } else {
- printf("\nReadKeyFile OK\n");
- }
-
- /* just print the rsaPrivString and rsaPubString */
- if (DEBUG) printf("\nrsaPrivString: %s\n", HexPriv);
- if (DEBUG) printf("\nrsaPubString: %s\n", HexPub);
-
- /* try to private encrypt-public decrypt something */
- if (DEBUG) pub_priv_test(HexPriv, HexPub);
-
- /* check all the Byte checksums
- rehexify it for our Check_All_Byte_Calculus_Data function ... */
- HexByte = Hexify(Byte, 1000);
- if (Check_All_Byte_Calculus_Data(HexByte) != 0) {
- printf("\nByte_Calculus_Data checksums do not match !\n");
- exit(1);
- } else {
- if (DEBUG) printf("\nThe Byte Calculus Data checksums match\n");
- }
-
- /* Check the KeyPythonPtr */
- PythonLength = strlen(HexPython)/2;
- PythonData = DeHexify(HexPython);
- if (memcmp(PythonData, g_keycode, PythonLength) != 0) {
- printf("\nPython Byte code datablocks do not match !\n");
- exit(1);
- } else {
- if (DEBUG) printf("\nThe Python Byte code datablock matches\n");
- }
-
- return(0);
-}
-#else
-int main(int argc, char **argv) {
- FILE *rawkeyfile;
- char *AsciiHash;
- char *HexCryptedData, *HexCryptedKey;
- int newlinetracker = 0; /* line position, counts from 0-71 */
- byte *CryptKey;
- char *KeyDataString;
- char *KeyDataPtr;
- char *mdhex;
- char *rsaPrivString;
- char *rsaPubString;
- char *KeyBytePtr;
- char *KeyPythonPtr;
- byte *PythonData;
- int PythonLength;
- UserStruct User;
-
- if (argc != 2) {
- printf("usage: %s keyfile\n", argv[0]);
- exit(1);
- }
-
- /* open keyfile for reading */
- if ((rawkeyfile = fopen(argv[1], "r")) == NULL) {
- printf("error, cannot read %s\n", argv[1]);
- exit(1);
- }
-
- /* Scan and interpret the ASCII part */
- AsciiHash = scan_ascii(rawkeyfile, &User);
- if (DEBUG) printf("\nHexHash: %s\n", AsciiHash);
-
- /* Read the HexCryptedData */
- HexCryptedData = ReadHexCryptedData(rawkeyfile, &newlinetracker);
- if (DEBUG) printf("\nHexCryptedData: %s\n", HexCryptedData);
-
- /* Read the HexCryptedKey */
- HexCryptedKey = ReadHexCryptedKey(rawkeyfile, &newlinetracker);
- if (DEBUG) printf("\nHexCryptedKey: %s\n", HexCryptedKey);
-
- /* close keyfile */
- fclose(rawkeyfile);
-
- /* Decrypt HexCryptedKey */
- CryptKey = RSADecryptKey(HexCryptedKey);
-
- /* Decrypt HexCryptedData */
- KeyDataString = DeCryptDatablock(CryptKey, 16, HexCryptedData);
- free(CryptKey);
- free(HexCryptedData);
- free(HexCryptedKey);
- if (DEBUG) printf("\nKeyDataString: %s\n", KeyDataString);
-
- /* Extract data from KeyDataString */
- KeyDataPtr = KeyDataString;
-
- mdhex = get_from_datablock(&KeyDataPtr, "01");
- rsaPrivString = get_from_datablock(&KeyDataPtr, "02");
- rsaPubString = get_from_datablock(&KeyDataPtr, "03");
- KeyBytePtr = get_from_datablock(&KeyDataPtr, "04");
- KeyPythonPtr = get_from_datablock(&KeyDataPtr, "05");
- free(KeyDataString);
-
- /* Check ascii hash */
- if (strcmp(mdhex, AsciiHash) != 0) {
- printf("Ascii part checksums do not match !\n");
- printf("found: %s\n", mdhex);
- printf("check: %s\n", AsciiHash);
- exit(1);
- } else {
- if (DEBUG) printf("\nThe ascii part checksum matches\n");
- }
-
- /* just print the rsaPrivString and rsaPubString */
- if (DEBUG) printf("\nrsaPrivString: %s\n", rsaPrivString);
- if (DEBUG) printf("\nrsaPubString: %s\n", rsaPubString);
-
- /* check all the Byte checksums */
- if (Check_All_Byte_Calculus_Data(KeyBytePtr) != 0) {
- printf("Byte_Calculus_Data checksums do not match !\n");
- exit(1);
- } else {
- if (DEBUG) printf("\nThe Byte Calculus Data checksums match\n");
- }
-
- /* Check the KeyPythonPtr */
- PythonLength = strlen(KeyPythonPtr)/2;
- PythonData = DeHexify(KeyPythonPtr);
- if (memcmp(PythonData, g_keycode, PythonLength) != 0) {
- printf("Python Byte code datablocks do not match !\n");
- exit(1);
- } else {
- if (DEBUG) printf("\nThe Python Byte code datablock matches\n");
- }
-
- return(0);
-}
-#endif
diff --git a/intern/keymaker/make/msvc_6_0/blenkey.dsp b/intern/keymaker/make/msvc_6_0/blenkey.dsp
deleted file mode 100644
index 4cc63f9fc24..00000000000
--- a/intern/keymaker/make/msvc_6_0/blenkey.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="blenkey" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=blenkey - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "blenkey.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "blenkey.mak" CFG="blenkey - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "blenkey - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "blenkey - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "blenkey - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\..\obj\windows\intern\blenkey\"
-# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\blenkey\"
-# PROP Target_Dir ""
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "..\.." /I "..\..\..\..\..\lib\windows\openssl\include" /I "..\..\python" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\blenkey\libblenkey.lib"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Cmds=ECHO Copying header files XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\lib\windows\blenkey\include\ ECHO Copying lib XCOPY /Y ..\..\..\..\obj\windows\intern\blenkey\*.lib ..\..\..\..\..\lib\windows\blenkey\lib\*.a ECHO Done
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "blenkey - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\..\obj\windows\intern\blenkey\debug"
-# PROP Intermediate_Dir "..\..\..\..\obj\windows\intern\blenkey\debug"
-# PROP Target_Dir ""
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\..\..\lib\windows\openssl\include" /I "..\..\python" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\..\obj\windows\intern\blenkey\debug\libblenkey.lib"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Cmds=ECHO Copying header files XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\lib\windows\blenkey\include\ ECHO Copying lib XCOPY /Y ..\..\..\..\obj\windows\intern\blenkey\debug\*.lib ..\..\..\..\..\lib\windows\blenkey\lib\debug\*.a
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "blenkey - Win32 Release"
-# Name "blenkey - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\key.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\keyloader.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\mt19937int.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Group "intern"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\key_internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\mt19937int.h
-# End Source File
-# End Group
-# Begin Group "extern"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\blenkey.h
-# End Source File
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/intern/keymaker/make/msvc_6_0/blenkey.dsw b/intern/keymaker/make/msvc_6_0/blenkey.dsw
deleted file mode 100644
index 4d97144c6ed..00000000000
--- a/intern/keymaker/make/msvc_6_0/blenkey.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "blenkey"=".\blenkey.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/intern/keymaker/make/msvc_7_0/blenkey.sln b/intern/keymaker/make/msvc_7_0/blenkey.sln
deleted file mode 100644
index 5ddf040506e..00000000000
--- a/intern/keymaker/make/msvc_7_0/blenkey.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenkey", "blenkey.vcproj", "{E8AF94A5-15FC-432C-9FFD-68D9CD642488}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {E8AF94A5-15FC-432C-9FFD-68D9CD642488}.Debug.ActiveCfg = Debug|Win32
- {E8AF94A5-15FC-432C-9FFD-68D9CD642488}.Debug.Build.0 = Debug|Win32
- {E8AF94A5-15FC-432C-9FFD-68D9CD642488}.Release.ActiveCfg = Release|Win32
- {E8AF94A5-15FC-432C-9FFD-68D9CD642488}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/intern/keymaker/make/msvc_7_0/blenkey.vcproj b/intern/keymaker/make/msvc_7_0/blenkey.vcproj
deleted file mode 100644
index df24f3da382..00000000000
--- a/intern/keymaker/make/msvc_7_0/blenkey.vcproj
+++ /dev/null
@@ -1,282 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="blenkey"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Blender Debug|Win32"
- OutputDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\debug"
- IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\debug"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..;..\..\python;..\..\..\..\..\lib\windows\openssl\include"
- PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\blenkey\debug\blenkey.pch"
- AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\blenkey\debug\"
- ObjectFile="..\..\..\..\..\build\msvc_7\intern\blenkey\debug\"
- ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\blenkey\debug\"
- WarningLevel="2"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="3"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\debug\libblenkey.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying BLENKEY files library (debug target) to lib tree"
- CommandLine="ECHO Copying header files
-IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\blenkey\include MKDIR ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-ECHO Done
-"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Blender Release|Win32"
- OutputDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey"
- IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..;..\..\python;..\..\..\..\..\lib\windows\openssl\include"
- PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\blenkey\blenkey.pch"
- AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\blenkey\"
- ObjectFile="..\..\..\..\..\build\msvc_7\intern\blenkey\"
- ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\blenkey\"
- WarningLevel="2"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\libblenkey.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying BLENKEY files library to lib tree"
- CommandLine="ECHO Copying header files
-IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\blenkey\include MKDIR ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-ECHO Done
-"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="3DPlugin Release|Win32"
- OutputDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll"
- IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..;..\..\python;..\..\..\..\..\lib\windows\openssl\include"
- PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\blenkey.pch"
- AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\"
- ObjectFile="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\"
- ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\"
- WarningLevel="2"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\mtdll\libblenkey.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying BLENKEY files library to lib tree"
- CommandLine="ECHO Copying header files
-IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\blenkey\include MKDIR ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-ECHO Done
-"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="3DPlugin Debug|Win32"
- OutputDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug"
- IntermediateDirectory="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..;..\..\python;..\..\..\..\..\lib\windows\openssl\include"
- PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug\blenkey.pch"
- AssemblerListingLocation="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug\"
- ObjectFile="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug\"
- ProgramDataBaseFileName="..\..\..\..\..\build\msvc_7\intern\blenkey\mtdll\debug\"
- WarningLevel="2"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="3"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="..\..\..\..\..\build\msvc_7\libs\intern\mtdll\debug\libblenkey.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Copying BLENKEY files library (debug target) to lib tree"
- CommandLine="ECHO Copying header files
-IF NOT EXIST ..\..\..\..\..\build\msvc_7\intern\blenkey\include MKDIR ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-XCOPY /Y ..\..\blenkey.h ..\..\..\..\..\build\msvc_7\intern\blenkey\include
-ECHO Done
-"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
- <File
- RelativePath="..\..\key.c">
- </File>
- <File
- RelativePath="..\..\keyloader.c">
- </File>
- <File
- RelativePath="..\..\mt19937int.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl">
- <Filter
- Name="intern"
- Filter="">
- <File
- RelativePath="..\..\key_internal.h">
- </File>
- <File
- RelativePath="..\..\mt19937int.h">
- </File>
- </Filter>
- <Filter
- Name="extern"
- Filter="">
- <File
- RelativePath="..\..\blenkey.h">
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/intern/keymaker/mt19937int.c b/intern/keymaker/mt19937int.c
deleted file mode 100644
index 9481a48aade..00000000000
--- a/intern/keymaker/mt19937int.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* A C-program for MT19937: Integer version (1999/10/28) */
-
-/* genrand() generates one pseudorandom unsigned integer (32bit) */
-/* which is uniformly distributed among 0 to 2^32-1 for each */
-/* call. sgenrand(seed) sets initial values to the working area */
-/* of 624 words. Before genrand(), sgenrand(seed) must be */
-/* called once. (seed is any 32-bit integer.) */
-/* Coded by Takuji Nishimura, considering the suggestions by */
-/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */
-
-/* This library is free software under the Artistic license: */
-/* see the file COPYING distributed together with this code. */
-/* For the verification of the code, its output sequence file */
-/* mt19937int.out is attached (2001/4/2) */
-
-/* Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. */
-/* Any feedback is very welcome. For any question, comments, */
-/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */
-/* matumoto@math.keio.ac.jp */
-
-/* REFERENCE */
-/* M. Matsumoto and T. Nishimura, */
-/* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform */
-/* Pseudo-Random Number Generator", */
-/* ACM Transactions on Modeling and Computer Simulation, */
-/* Vol. 8, No. 1, January 1998, pp 3--30. */
-
-#include<stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mt19937int.h"
-
-/* Period parameters */
-#define N 624
-#define M 397
-#define MATRIX_A 0x9908b0df /* constant vector a */
-#define UPPER_MASK 0x80000000 /* most significant w-r bits */
-#define LOWER_MASK 0x7fffffff /* least significant r bits */
-
-/* Tempering parameters */
-#define TEMPERING_MASK_B 0x9d2c5680
-#define TEMPERING_MASK_C 0xefc60000
-#define TEMPERING_SHIFT_U(y) (y >> 11)
-#define TEMPERING_SHIFT_S(y) (y << 7)
-#define TEMPERING_SHIFT_T(y) (y << 15)
-#define TEMPERING_SHIFT_L(y) (y >> 18)
-
-static unsigned long mt[N]; /* the array for the state vector */
-static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
-
-/* Initializing the array with a seed */
-void sgenrand(signed long seed)
-{
- int i;
-
- for (i=0;i<N;i++) {
- mt[i] = seed & 0xffff0000;
- seed = 69069 * seed + 1;
- mt[i] |= (seed & 0xffff0000) >> 16;
- seed = 69069 * seed + 1;
- }
- mti = N;
-}
-
-/* Initialization by "sgenrand()" is an example. Theoretically, */
-/* there are 2^19937-1 possible states as an intial state. */
-/* This function allows to choose any of 2^19937-1 ones. */
-/* Essential bits in "seed_array[]" is following 19937 bits: */
-/* (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1]. */
-/* (seed_array[0]&LOWER_MASK) is discarded. */
-/* Theoretically, */
-/* (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1] */
-/* can take any values except all zeros. */
-void lsgenrand(unsigned long *seed_array)
- /* the length of seed_array[] must be at least N */
-{
- int i;
-
- for (i=0;i<N;i++)
- mt[i] = seed_array[i];
- mti=N;
-}
-
-unsigned long genrand()
-{
- unsigned long y;
- static unsigned long mag01[2]={0x0, MATRIX_A};
- /* mag01[x] = x * MATRIX_A for x=0,1 */
-
- if (mti >= N) { /* generate N words at one time */
- int kk;
-
- if (mti == N+1) /* if sgenrand() has not been called, */
- sgenrand(4357); /* a default initial seed is used */
-
- for (kk=0;kk<N-M;kk++) {
- y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
- }
- for (;kk<N-1;kk++) {
- y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= TEMPERING_SHIFT_U(y);
- y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
- y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
- y ^= TEMPERING_SHIFT_L(y);
-
- return y;
-}
-
-/* This main() outputs first 1000 generated numbers. */
-/*
-main()
-{
- int i;
-
- sgenrand(4357);
- for (i=0; i<1000; i++) {
- printf("%10lu ", genrand());
- if (i%5==4) printf("\n");
- }
-}
-*/
diff --git a/intern/keymaker/mt19937int.h b/intern/keymaker/mt19937int.h
deleted file mode 100644
index e49c7bc3a27..00000000000
--- a/intern/keymaker/mt19937int.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/* ex:ts=4 */
-
-/**
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * Mersenne Twister prototypes
- */
-
-/* external: */
-void sgenrand(signed long seed);
-unsigned long genrand(void);
-
-/* internal: */
-void lsgenrand(unsigned long *seed_array);
-
diff --git a/intern/keymaker/python/key_pyc.h b/intern/keymaker/python/key_pyc.h
deleted file mode 100644
index 16dd15f6e86..00000000000
--- a/intern/keymaker/python/key_pyc.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * $Id$
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/BL DUAL LICENSE BLOCK *****
- */
-
-/* generated by keygen.py -- don't edit !! */
-
-
-#define KEYCODELEN 1157
-static unsigned char g_keycode[] = {
- 0x63,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x73,
- 0xb3,0x00,0x00,0x00,0x7f,0x00,0x00,0x7f,0x02,0x00,
- 0x64,0x00,0x00,0x6b,0x00,0x00,0x5a,0x00,0x00,0x7f,
- 0x06,0x00,0x64,0x01,0x00,0x84,0x00,0x00,0x5a,0x01,
- 0x00,0x7f,0x09,0x00,0x64,0x02,0x00,0x84,0x00,0x00,
- 0x5a,0x02,0x00,0x7f,0x11,0x00,0x64,0x03,0x00,0x84,
- 0x00,0x00,0x5a,0x03,0x00,0x7f,0x1c,0x00,0x65,0x00,
- 0x00,0x69,0x04,0x00,0x83,0x00,0x00,0x5a,0x05,0x00,
- 0x7f,0x1d,0x00,0x7f,0x21,0x00,0x65,0x00,0x00,0x69,
- 0x06,0x00,0x83,0x00,0x00,0x5a,0x07,0x00,0x7f,0x22,
- 0x00,0x65,0x08,0x00,0x65,0x07,0x00,0x83,0x01,0x00,
- 0x5a,0x09,0x00,0x7f,0x23,0x00,0x65,0x03,0x00,0x65,
- 0x09,0x00,0x83,0x01,0x00,0x01,0x7f,0x24,0x00,0x78,
- 0x39,0x00,0x65,0x0a,0x00,0x65,0x07,0x00,0x83,0x01,
- 0x00,0x64,0x04,0x00,0x7f,0x24,0x00,0x72,0x26,0x00,
- 0x5a,0x0b,0x00,0x7f,0x25,0x00,0x65,0x00,0x00,0x69,
- 0x0c,0x00,0x65,0x09,0x00,0x65,0x0b,0x00,0x19,0x65,
- 0x00,0x00,0x69,0x0d,0x00,0x65,0x0b,0x00,0x83,0x01,
- 0x00,0x83,0x02,0x00,0x01,0x71,0x82,0x00,0x57,0x64,
- 0x00,0x00,0x53,0x28,0x05,0x00,0x00,0x00,0x4e,0x63,
- 0x03,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x73,0x1c,
- 0x00,0x00,0x00,0x7f,0x06,0x00,0x7f,0x07,0x00,0x7f,
- 0x08,0x00,0x7c,0x00,0x00,0x7c,0x01,0x00,0x7c,0x02,
- 0x00,0x66,0x03,0x00,0x61,0x03,0x00,0x64,0x00,0x00,
- 0x53,0x28,0x01,0x00,0x00,0x00,0x4e,0x28,0x04,0x00,
- 0x00,0x00,0x73,0x01,0x00,0x00,0x00,0x61,0x73,0x01,
- 0x00,0x00,0x00,0x62,0x73,0x01,0x00,0x00,0x00,0x63,
- 0x73,0x05,0x00,0x00,0x00,0x5f,0x73,0x65,0x65,0x64,
- 0x28,0x03,0x00,0x00,0x00,0x73,0x01,0x00,0x00,0x00,
- 0x61,0x73,0x01,0x00,0x00,0x00,0x62,0x73,0x01,0x00,
- 0x00,0x00,0x63,0x73,0x08,0x00,0x00,0x00,0x3c,0x73,
- 0x74,0x72,0x69,0x6e,0x67,0x3e,0x73,0x04,0x00,0x00,
- 0x00,0x73,0x65,0x65,0x64,0x06,0x00,0x73,0x04,0x00,
- 0x00,0x00,0x03,0x01,0x03,0x01,0x63,0x00,0x00,0x03,
- 0x00,0x03,0x00,0x03,0x00,0x73,0x70,0x00,0x00,0x00,
- 0x7f,0x09,0x00,0x7f,0x0a,0x00,0x7f,0x0b,0x00,0x74,
- 0x00,0x00,0x5c,0x03,0x00,0x7d,0x00,0x00,0x7d,0x01,
- 0x00,0x7d,0x02,0x00,0x7f,0x0c,0x00,0x64,0x01,0x00,
- 0x7c,0x00,0x00,0x14,0x64,0x02,0x00,0x16,0x7d,0x00,
- 0x00,0x7f,0x0d,0x00,0x64,0x03,0x00,0x7c,0x01,0x00,
- 0x14,0x64,0x04,0x00,0x16,0x7d,0x01,0x00,0x7f,0x0e,
- 0x00,0x64,0x05,0x00,0x7c,0x02,0x00,0x14,0x64,0x06,
- 0x00,0x16,0x7d,0x02,0x00,0x7f,0x0f,0x00,0x7c,0x00,
- 0x00,0x7c,0x01,0x00,0x7c,0x02,0x00,0x66,0x03,0x00,
- 0x61,0x00,0x00,0x7f,0x10,0x00,0x7c,0x00,0x00,0x7c,
- 0x01,0x00,0x17,0x7c,0x02,0x00,0x17,0x53,0x64,0x00,
- 0x00,0x53,0x28,0x07,0x00,0x00,0x00,0x4e,0x69,0xab,
- 0x00,0x00,0x00,0x69,0x3d,0x76,0x00,0x00,0x69,0xac,
- 0x00,0x00,0x00,0x69,0x63,0x76,0x00,0x00,0x69,0xaa,
- 0x00,0x00,0x00,0x69,0x73,0x76,0x00,0x00,0x28,0x04,
- 0x00,0x00,0x00,0x73,0x05,0x00,0x00,0x00,0x5f,0x73,
- 0x65,0x65,0x64,0x73,0x01,0x00,0x00,0x00,0x61,0x73,
- 0x01,0x00,0x00,0x00,0x62,0x73,0x01,0x00,0x00,0x00,
- 0x63,0x28,0x03,0x00,0x00,0x00,0x73,0x01,0x00,0x00,
- 0x00,0x61,0x73,0x01,0x00,0x00,0x00,0x62,0x73,0x01,
- 0x00,0x00,0x00,0x63,0x73,0x08,0x00,0x00,0x00,0x3c,
- 0x73,0x74,0x72,0x69,0x6e,0x67,0x3e,0x73,0x09,0x00,
- 0x00,0x00,0x72,0x61,0x6e,0x64,0x6f,0x6d,0x69,0x7a,
- 0x65,0x09,0x00,0x73,0x0e,0x00,0x00,0x00,0x03,0x01,
- 0x03,0x01,0x12,0x01,0x11,0x01,0x11,0x01,0x11,0x01,
- 0x12,0x01,0x63,0x01,0x00,0x06,0x00,0x06,0x00,0x03,
- 0x00,0x73,0x8b,0x00,0x00,0x00,0x7f,0x11,0x00,0x7f,
- 0x13,0x00,0x74,0x00,0x00,0x7c,0x00,0x00,0x83,0x01,
- 0x00,0x7d,0x01,0x00,0x7f,0x14,0x00,0x78,0x6f,0x00,
- 0x74,0x03,0x00,0x7c,0x01,0x00,0x83,0x01,0x00,0x64,
- 0x01,0x00,0x7f,0x14,0x00,0x72,0x5c,0x00,0x7d,0x02,
- 0x00,0x7f,0x15,0x00,0x7c,0x01,0x00,0x7c,0x02,0x00,
- 0x18,0x7d,0x03,0x00,0x7f,0x16,0x00,0x74,0x06,0x00,
- 0x74,0x07,0x00,0x83,0x00,0x00,0x7c,0x03,0x00,0x16,
- 0x83,0x01,0x00,0x7d,0x04,0x00,0x7f,0x17,0x00,0x7c,
- 0x00,0x00,0x7c,0x02,0x00,0x19,0x7d,0x05,0x00,0x7f,
- 0x18,0x00,0x7c,0x00,0x00,0x7c,0x02,0x00,0x7c,0x04,
- 0x00,0x17,0x19,0x7c,0x00,0x00,0x7c,0x02,0x00,0x3c,
- 0x7f,0x19,0x00,0x7c,0x05,0x00,0x7c,0x00,0x00,0x7c,
- 0x02,0x00,0x7c,0x04,0x00,0x17,0x3c,0x71,0x24,0x00,
- 0x57,0x64,0x00,0x00,0x53,0x28,0x02,0x00,0x00,0x00,
- 0x4e,0x69,0x00,0x00,0x00,0x00,0x28,0x0a,0x00,0x00,
- 0x00,0x73,0x03,0x00,0x00,0x00,0x6c,0x65,0x6e,0x73,
- 0x04,0x00,0x00,0x00,0x6c,0x69,0x73,0x74,0x73,0x04,
- 0x00,0x00,0x00,0x73,0x69,0x7a,0x65,0x73,0x06,0x00,
- 0x00,0x00,0x78,0x72,0x61,0x6e,0x67,0x65,0x73,0x01,
- 0x00,0x00,0x00,0x69,0x73,0x04,0x00,0x00,0x00,0x6c,
- 0x65,0x66,0x74,0x73,0x03,0x00,0x00,0x00,0x69,0x6e,
- 0x74,0x73,0x09,0x00,0x00,0x00,0x72,0x61,0x6e,0x64,
- 0x6f,0x6d,0x69,0x7a,0x65,0x73,0x01,0x00,0x00,0x00,
- 0x72,0x73,0x03,0x00,0x00,0x00,0x74,0x6d,0x70,0x28,
- 0x06,0x00,0x00,0x00,0x73,0x04,0x00,0x00,0x00,0x6c,
- 0x69,0x73,0x74,0x73,0x04,0x00,0x00,0x00,0x73,0x69,
- 0x7a,0x65,0x73,0x01,0x00,0x00,0x00,0x69,0x73,0x04,
- 0x00,0x00,0x00,0x6c,0x65,0x66,0x74,0x73,0x01,0x00,
- 0x00,0x00,0x72,0x73,0x03,0x00,0x00,0x00,0x74,0x6d,
- 0x70,0x73,0x08,0x00,0x00,0x00,0x3c,0x73,0x74,0x72,
- 0x69,0x6e,0x67,0x3e,0x73,0x04,0x00,0x00,0x00,0x73,
- 0x74,0x69,0x72,0x11,0x00,0x73,0x10,0x00,0x00,0x00,
- 0x03,0x02,0x0f,0x01,0x12,0x00,0x09,0x01,0x0d,0x01,
- 0x16,0x01,0x0d,0x01,0x15,0x01,0x69,0x00,0x00,0x00,
- 0x00,0x28,0x0e,0x00,0x00,0x00,0x73,0x04,0x00,0x00,
- 0x00,0x70,0x72,0x6f,0x74,0x73,0x04,0x00,0x00,0x00,
- 0x73,0x65,0x65,0x64,0x73,0x09,0x00,0x00,0x00,0x72,
- 0x61,0x6e,0x64,0x6f,0x6d,0x69,0x7a,0x65,0x73,0x04,
- 0x00,0x00,0x00,0x73,0x74,0x69,0x72,0x73,0x07,0x00,
- 0x00,0x00,0x67,0x65,0x74,0x73,0x65,0x65,0x64,0x73,
- 0x05,0x00,0x00,0x00,0x5f,0x73,0x65,0x65,0x64,0x73,
- 0x06,0x00,0x00,0x00,0x67,0x65,0x74,0x6c,0x65,0x6e,
- 0x73,0x01,0x00,0x00,0x00,0x6e,0x73,0x05,0x00,0x00,
- 0x00,0x72,0x61,0x6e,0x67,0x65,0x73,0x04,0x00,0x00,
- 0x00,0x6c,0x69,0x73,0x74,0x73,0x06,0x00,0x00,0x00,
- 0x78,0x72,0x61,0x6e,0x67,0x65,0x73,0x01,0x00,0x00,
- 0x00,0x69,0x73,0x06,0x00,0x00,0x00,0x73,0x65,0x74,
- 0x70,0x74,0x72,0x73,0x06,0x00,0x00,0x00,0x67,0x65,
- 0x74,0x70,0x74,0x72,0x28,0x00,0x00,0x00,0x00,0x73,
- 0x08,0x00,0x00,0x00,0x3c,0x73,0x74,0x72,0x69,0x6e,
- 0x67,0x3e,0x73,0x01,0x00,0x00,0x00,0x3f,0x02,0x00,
- 0x73,0x16,0x00,0x00,0x00,0x0f,0x04,0x0c,0x03,0x0c,
- 0x08,0x0c,0x0b,0x0f,0x01,0x03,0x04,0x0f,0x01,0x0f,
- 0x01,0x0d,0x01,0x12,0x00,0x09,0x01
-};
-
diff --git a/intern/make/msvc_7_0/intern.sln b/intern/make/msvc_7_0/intern.sln
index 146a0297dc1..5fdb4ca95d0 100644
--- a/intern/make/msvc_7_0/intern.sln
+++ b/intern/make/msvc_7_0/intern.sln
@@ -8,7 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build_install_all", "build_
{B093415D-C0F6-4E76-8F5A-6BC1917BCE9E} = {B093415D-C0F6-4E76-8F5A-6BC1917BCE9E}
{E784098D-3ED8-433A-9353-9679415DDDC5} = {E784098D-3ED8-433A-9353-9679415DDDC5}
{76D90B92-ECC7-409C-9F98-A8814B90F3C0} = {76D90B92-ECC7-409C-9F98-A8814B90F3C0}
- {121EC196-8E8A-4937-B0BD-0F114C87D55E} = {121EC196-8E8A-4937-B0BD-0F114C87D55E}
{542A9FA1-B7FF-441C-AE15-054DB31D3488} = {542A9FA1-B7FF-441C-AE15-054DB31D3488}
{213356A9-3A1F-41DA-9819-1297BCD17DEE} = {213356A9-3A1F-41DA-9819-1297BCD17DEE}
{51A348C1-8684-4D67-B980-97B1FC74159B} = {51A348C1-8684-4D67-B980-97B1FC74159B}
@@ -24,10 +23,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoTo", "..\..\moto\make\msv
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenkey", "..\..\keymaker\make\msvc_7_0\blenkey.vcproj", "{121EC196-8E8A-4937-B0BD-0F114C87D55E}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmfont", "..\..\bmfont\make\msvc_7_0\bmfont.vcproj", "{E784098D-3ED8-433A-9353-9679415DDDC5}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
@@ -110,6 +105,8 @@ Global
Blender Debug = Blender Debug
Blender Release = Blender Release
EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{02110D03-59DB-4571-8787-72B3C03B2F2D}.3DPlugin Debug.ActiveCfg = 3DPlugin Debug|Win32
{02110D03-59DB-4571-8787-72B3C03B2F2D}.3DPlugin Debug.Build.0 = 3DPlugin Debug|Win32
@@ -127,14 +124,6 @@ Global
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}.Blender Debug.Build.0 = Blender Debug|Win32
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}.Blender Release.ActiveCfg = Blender Release|Win32
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74}.Blender Release.Build.0 = Blender Release|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.3DPlugin Debug.ActiveCfg = 3DPlugin Debug|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.3DPlugin Debug.Build.0 = 3DPlugin Debug|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.3DPlugin Release.ActiveCfg = 3DPlugin Release|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.3DPlugin Release.Build.0 = 3DPlugin Release|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.Blender Debug.ActiveCfg = Blender Debug|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.Blender Debug.Build.0 = Blender Debug|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.Blender Release.ActiveCfg = Blender Release|Win32
- {121EC196-8E8A-4937-B0BD-0F114C87D55E}.Blender Release.Build.0 = Blender Release|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.3DPlugin Debug.ActiveCfg = 3DPlugin Debug|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.3DPlugin Debug.Build.0 = 3DPlugin Debug|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.3DPlugin Release.ActiveCfg = 3DPlugin Release|Win32
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index c1c805b6310..13fb6b23446 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -68,6 +68,7 @@ extern "C" {
extern int MEM_CacheLimiter_get_maximum();
// this is rather _ugly_!
extern int mem_in_use;
+ extern int mmap_in_use;
};
#endif
@@ -148,7 +149,7 @@ public:
return;
}
for (iterator it = queue.begin();
- it != queue.end() && mem_in_use > max;) {
+ it != queue.end() && mem_in_use + mmap_in_use > max;) {
iterator jt = it;
++it;
(*jt)->destroy_if_possible();
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index fb899a7da96..98851e73040 100755..100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -147,6 +147,26 @@ public:
-sj, cj * si, cj * ci);
}
+ void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const
+ {
+ if (m_el[2][0] != -1.0 && m_el[2][0] != 1.0) {
+ pitch = MT_Scalar(-asin(m_el[2][0]));
+ yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch)));
+ roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch)));
+ }
+ else {
+ roll = MT_Scalar(0);
+ if (m_el[2][0] == -1.0) {
+ pitch = MT_PI / 2.0;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ else {
+ pitch = - MT_PI / 2.0;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ }
+ }
+
void scale(MT_Scalar x, MT_Scalar y, MT_Scalar z) {
m_el[0][0] *= x; m_el[0][1] *= y; m_el[0][2] *= z;
m_el[1][0] *= x; m_el[1][1] *= y; m_el[1][2] *= z;
diff --git a/intern/moto/include/MT_Vector3.h b/intern/moto/include/MT_Vector3.h
index 41291e915be..c35a9d47234 100644
--- a/intern/moto/include/MT_Vector3.h
+++ b/intern/moto/include/MT_Vector3.h
@@ -51,6 +51,7 @@
class MT_Vector3 : public MT_Tuple3 {
public:
+ virtual ~MT_Vector3() {}
MT_Vector3() {}
MT_Vector3(const float *v) : MT_Tuple3(v) {}
MT_Vector3(const double *v) : MT_Tuple3(v) {}
diff --git a/intern/moto/include/MT_Vector4.h b/intern/moto/include/MT_Vector4.h
index fa91abf2a84..5f1ee99d584 100644
--- a/intern/moto/include/MT_Vector4.h
+++ b/intern/moto/include/MT_Vector4.h
@@ -52,6 +52,7 @@
class MT_Vector4 : public MT_Tuple4 {
public:
+ virtual ~MT_Vector4() {}
MT_Vector4() {}
MT_Vector4(const float *v) : MT_Tuple4(v) {}
MT_Vector4(const double *v) : MT_Tuple4(v) {}
diff --git a/intern/moto/include/MT_assert.h b/intern/moto/include/MT_assert.h
index c20f5699ea3..54aea403cda 100644
--- a/intern/moto/include/MT_assert.h
+++ b/intern/moto/include/MT_assert.h
@@ -48,7 +48,7 @@
// file, line, predicate form the message to ask, *do_assert should be set
// to 0 to ignore.
// returns 1 to break, false to ignore
-MT_CDECL int MT_QueryAssert(char *file, int line, char *predicate, int *do_assert);
+MT_CDECL int MT_QueryAssert(const char *file, int line, const char *predicate, int *do_assert);
#ifdef NDEBUG
diff --git a/intern/moto/intern/MT_Assert.cpp b/intern/moto/intern/MT_Assert.cpp
index 999e3da5842..c16c43f2045 100644
--- a/intern/moto/intern/MT_Assert.cpp
+++ b/intern/moto/intern/MT_Assert.cpp
@@ -45,7 +45,7 @@
// Query the user if they want to break/abort the program, ignore the assert, or ignore all future
// occurance of the assert.
-int MT_QueryAssert(char *file, int line, char *predicate, int *do_assert)
+int MT_QueryAssert(const char *file, int line, const char *predicate, int *do_assert)
{
#ifdef _WIN32
if (*do_assert)
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript
index bcfb030f7e6..e46cefbff58 100644
--- a/intern/opennl/SConscript
+++ b/intern/opennl/SConscript
@@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c')
incs = 'extern superlu'
if (env['OURPLATFORM'] == 'win32-mingw'):
- env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] )
+ env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern','player'], priority=[1,80,22] )
else:
- env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype='core', priority=55 )
+ env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','player'], priority=[55,22] )
diff --git a/intern/opennl/extern/ONL_opennl.h b/intern/opennl/extern/ONL_opennl.h
index 345cf0dc717..be76aa95eac 100644
--- a/intern/opennl/extern/ONL_opennl.h
+++ b/intern/opennl/extern/ONL_opennl.h
@@ -79,20 +79,16 @@ typedef void* NLContext;
#define NL_SYSTEM 0x0
#define NL_MATRIX 0x1
-#define NL_ROW 0x2
/* Solver Parameters */
-#define NL_SOLVER 0x100
-#define NL_NB_VARIABLES 0x101
-#define NL_LEAST_SQUARES 0x102
-#define NL_SYMMETRIC 0x106
-#define NL_ERROR 0x108
-
-/* Row parameters */
-
-#define NL_RIGHT_HAND_SIDE 0x500
-#define NL_ROW_SCALING 0x501
+#define NL_SOLVER 0x100
+#define NL_NB_VARIABLES 0x101
+#define NL_LEAST_SQUARES 0x102
+#define NL_SYMMETRIC 0x106
+#define NL_ERROR 0x108
+#define NL_NB_ROWS 0x110
+#define NL_NB_RIGHT_HAND_SIDES 0x112 /* 4 max */
/* Contexts */
@@ -106,9 +102,6 @@ NLContext nlGetCurrent(void);
void nlSolverParameterf(NLenum pname, NLfloat param);
void nlSolverParameteri(NLenum pname, NLint param);
-void nlRowParameterf(NLenum pname, NLfloat param);
-void nlRowParameteri(NLenum pname, NLint param);
-
void nlGetBooleanv(NLenum pname, NLboolean* params);
void nlGetFloatv(NLenum pname, NLfloat* params);
void nlGetIntergerv(NLenum pname, NLint* params);
@@ -119,8 +112,8 @@ NLboolean nlIsEnabled(NLenum pname);
/* Variables */
-void nlSetVariable(NLuint index, NLfloat value);
-NLfloat nlGetVariable(NLuint index);
+void nlSetVariable(NLuint rhsindex, NLuint index, NLfloat value);
+NLfloat nlGetVariable(NLuint rhsindex, NLuint index);
void nlLockVariable(NLuint index);
void nlUnlockVariable(NLuint index);
NLboolean nlVariableIsLocked(NLuint index);
@@ -129,12 +122,16 @@ NLboolean nlVariableIsLocked(NLuint index);
void nlBegin(NLenum primitive);
void nlEnd(NLenum primitive);
-void nlCoefficient(NLuint index, NLfloat value);
-/* Setting random elements matrix/vector - not for least squares! */
+/* Setting elements in matrix/vector */
void nlMatrixAdd(NLuint row, NLuint col, NLfloat value);
-void nlRightHandSideAdd(NLuint index, NLfloat value);
+void nlRightHandSideAdd(NLuint rhsindex, NLuint index, NLfloat value);
+void nlRightHandSideSet(NLuint rhsindex, NLuint index, NLfloat value);
+
+/* Multiply */
+
+void nlMatrixMultiply(NLfloat *x, NLfloat *y);
/* Solve */
diff --git a/intern/opennl/intern/opennl.c b/intern/opennl/intern/opennl.c
index c5518731c6b..d779e861cb6 100644
--- a/intern/opennl/intern/opennl.c
+++ b/intern/opennl/intern/opennl.c
@@ -207,10 +207,6 @@ static void __nlRowColumnAppend(__NLRowColumn* c, NLint index, NLfloat value) {
c->size++;
}
-static void __nlRowColumnZero(__NLRowColumn* c) {
- c->size = 0;
-}
-
static void __nlRowColumnClear(__NLRowColumn* c) {
c->size = 0;
c->capacity = 0;
@@ -244,7 +240,7 @@ static void __nlSparseMatrixConstruct(
M->storage = storage;
if(storage & __NL_ROWS) {
M->row = __NL_NEW_ARRAY(__NLRowColumn, m);
- for(i=0; i<n; i++) {
+ for(i=0; i<m; i++) {
__nlRowColumnConstruct(&(M->row[i]));
}
} else {
@@ -432,48 +428,98 @@ static void __nlSparseMatrixMult(__NLSparseMatrix* A, NLfloat* x, NLfloat* y) {
}
}
+/* ****************** Routines for least squares ******************* */
+
+static void __nlSparseMatrix_square(
+ __NLSparseMatrix* AtA, __NLSparseMatrix *A
+) {
+ NLuint m = A->m;
+ NLuint n = A->n;
+ NLuint i, j0, j1;
+ __NLRowColumn *Ri = NULL;
+ __NLCoeff *c0 = NULL, *c1 = NULL;
+ float value;
+
+ __nlSparseMatrixConstruct(AtA, n, n, A->storage);
+
+ for(i=0; i<m; i++) {
+ Ri = &(A->row[i]);
+
+ for(j0=0; j0<Ri->size; j0++) {
+ c0 = &(Ri->coeff[j0]);
+ for(j1=0; j1<Ri->size; j1++) {
+ c1 = &(Ri->coeff[j1]);
+
+ value = c0->value*c1->value;
+ __nlSparseMatrixAdd(AtA, c0->index, c1->index, value);
+ }
+ }
+ }
+}
+
+static void __nlSparseMatrix_transpose_mult_rows(
+ __NLSparseMatrix* A, NLfloat* x, NLfloat* y
+) {
+ NLuint m = A->m;
+ NLuint n = A->n;
+ NLuint i,ij;
+ __NLRowColumn* Ri = NULL;
+ __NLCoeff* c = NULL;
+
+ __NL_CLEAR_ARRAY(NLfloat, y, n);
+
+ for(i=0; i<m; i++) {
+ Ri = &(A->row[i]);
+ for(ij=0; ij<Ri->size; ij++) {
+ c = &(Ri->coeff[ij]);
+ y[c->index] += c->value * x[i];
+ }
+ }
+}
+
/************************************************************************************/
/* NLContext data structure */
typedef void(*__NLMatrixFunc)(float* x, float* y);
typedef struct {
- NLfloat value;
+ NLfloat value[4];
NLboolean locked;
NLuint index;
+ __NLRowColumn *a;
} __NLVariable;
#define __NL_STATE_INITIAL 0
#define __NL_STATE_SYSTEM 1
#define __NL_STATE_MATRIX 2
-#define __NL_STATE_ROW 3
-#define __NL_STATE_MATRIX_CONSTRUCTED 4
-#define __NL_STATE_SYSTEM_CONSTRUCTED 5
-#define __NL_STATE_SYSTEM_SOLVED 7
+#define __NL_STATE_MATRIX_CONSTRUCTED 3
+#define __NL_STATE_SYSTEM_CONSTRUCTED 4
+#define __NL_STATE_SYSTEM_SOLVED 5
typedef struct {
- NLenum state;
+ NLenum state;
+ NLuint n;
+ NLuint m;
__NLVariable* variable;
- NLuint n;
+ NLfloat* b;
+ NLfloat* Mtb;
__NLSparseMatrix M;
- __NLRowColumn af;
- __NLRowColumn al;
+ __NLSparseMatrix MtM;
NLfloat* x;
- NLfloat* b;
- NLfloat right_hand_side;
- NLuint nb_variables;
- NLuint current_row;
+ NLuint nb_variables;
+ NLuint nb_rows;
NLboolean least_squares;
NLboolean symmetric;
+ NLuint nb_rhs;
NLboolean solve_again;
NLboolean alloc_M;
- NLboolean alloc_af;
- NLboolean alloc_al;
+ NLboolean alloc_MtM;
NLboolean alloc_variable;
NLboolean alloc_x;
NLboolean alloc_b;
- NLfloat error;
- __NLMatrixFunc matrix_vector_prod;
+ NLboolean alloc_Mtb;
+ NLfloat error;
+ __NLMatrixFunc matrix_vector_prod;
struct __NLSuperLUContext {
NLboolean alloc_slu;
@@ -493,8 +539,8 @@ static void __nlMatrixVectorProd_default(NLfloat* x, NLfloat* y) {
NLContext nlNewContext(void) {
__NLContext* result = __NL_NEW(__NLContext);
result->state = __NL_STATE_INITIAL;
- result->right_hand_side = 0.0;
result->matrix_vector_prod = __nlMatrixVectorProd_default;
+ result->nb_rhs = 1;
nlMakeCurrent(result);
return result;
}
@@ -503,27 +549,34 @@ static void __nlFree_SUPERLU(__NLContext *context);
void nlDeleteContext(NLContext context_in) {
__NLContext* context = (__NLContext*)(context_in);
+ int i;
+
if(__nlCurrentContext == context) {
__nlCurrentContext = NULL;
}
if(context->alloc_M) {
__nlSparseMatrixDestroy(&context->M);
}
- if(context->alloc_af) {
- __nlRowColumnDestroy(&context->af);
- }
- if(context->alloc_al) {
- __nlRowColumnDestroy(&context->al);
+ if(context->alloc_MtM) {
+ __nlSparseMatrixDestroy(&context->MtM);
}
if(context->alloc_variable) {
- __NL_DELETE_ARRAY(context->variable);
- }
- if(context->alloc_x) {
- __NL_DELETE_ARRAY(context->x);
+ for(i=0; i<context->nb_variables; i++) {
+ if(context->variable[i].a) {
+ __nlRowColumnDestroy(context->variable[i].a);
+ __NL_DELETE(context->variable[i].a);
+ }
+ }
}
if(context->alloc_b) {
__NL_DELETE_ARRAY(context->b);
}
+ if(context->alloc_Mtb) {
+ __NL_DELETE_ARRAY(context->Mtb);
+ }
+ if(context->alloc_x) {
+ __NL_DELETE_ARRAY(context->x);
+ }
if (context->slu.alloc_slu) {
__nlFree_SUPERLU(context);
}
@@ -561,12 +614,19 @@ void nlSolverParameterf(NLenum pname, NLfloat param) {
__nl_assert(param > 0);
__nlCurrentContext->nb_variables = (NLuint)param;
} break;
+ case NL_NB_ROWS: {
+ __nl_assert(param > 0);
+ __nlCurrentContext->nb_rows = (NLuint)param;
+ } break;
case NL_LEAST_SQUARES: {
__nlCurrentContext->least_squares = (NLboolean)param;
} break;
case NL_SYMMETRIC: {
__nlCurrentContext->symmetric = (NLboolean)param;
- }
+ } break;
+ case NL_NB_RIGHT_HAND_SIDES: {
+ __nlCurrentContext->nb_rhs = (NLuint)param;
+ } break;
default: {
__nl_assert_not_reached;
} break;
@@ -580,32 +640,21 @@ void nlSolverParameteri(NLenum pname, NLint param) {
__nl_assert(param > 0);
__nlCurrentContext->nb_variables = (NLuint)param;
} break;
+ case NL_NB_ROWS: {
+ __nl_assert(param > 0);
+ __nlCurrentContext->nb_rows = (NLuint)param;
+ } break;
case NL_LEAST_SQUARES: {
__nlCurrentContext->least_squares = (NLboolean)param;
} break;
case NL_SYMMETRIC: {
__nlCurrentContext->symmetric = (NLboolean)param;
- }
- default: {
- __nl_assert_not_reached;
} break;
- }
-}
-
-void nlRowParameterf(NLenum pname, NLfloat param) {
- __nlCheckState(__NL_STATE_MATRIX);
- switch(pname) {
- case NL_RIGHT_HAND_SIDE: {
- __nlCurrentContext->right_hand_side = param;
+ case NL_NB_RIGHT_HAND_SIDES: {
+ __nlCurrentContext->nb_rhs = (NLuint)param;
} break;
- }
-}
-
-void nlRowParameteri(NLenum pname, NLint param) {
- __nlCheckState(__NL_STATE_MATRIX);
- switch(pname) {
- case NL_RIGHT_HAND_SIDE: {
- __nlCurrentContext->right_hand_side = (NLfloat)param;
+ default: {
+ __nl_assert_not_reached;
} break;
}
}
@@ -629,6 +678,9 @@ void nlGetFloatv(NLenum pname, NLfloat* params) {
case NL_NB_VARIABLES: {
*params = (NLfloat)(__nlCurrentContext->nb_variables);
} break;
+ case NL_NB_ROWS: {
+ *params = (NLfloat)(__nlCurrentContext->nb_rows);
+ } break;
case NL_LEAST_SQUARES: {
*params = (NLfloat)(__nlCurrentContext->least_squares);
} break;
@@ -649,6 +701,9 @@ void nlGetIntergerv(NLenum pname, NLint* params) {
case NL_NB_VARIABLES: {
*params = (NLint)(__nlCurrentContext->nb_variables);
} break;
+ case NL_NB_ROWS: {
+ *params = (NLint)(__nlCurrentContext->nb_rows);
+ } break;
case NL_LEAST_SQUARES: {
*params = (NLint)(__nlCurrentContext->least_squares);
} break;
@@ -692,16 +747,16 @@ NLboolean nlIsEnabled(NLenum pname) {
/************************************************************************************/
/* Get/Set Lock/Unlock variables */
-void nlSetVariable(NLuint index, NLfloat value) {
+void nlSetVariable(NLuint rhsindex, NLuint index, NLfloat value) {
__nlCheckState(__NL_STATE_SYSTEM);
__nl_parano_range_assert(index, 0, __nlCurrentContext->nb_variables - 1);
- __nlCurrentContext->variable[index].value = value;
+ __nlCurrentContext->variable[index].value[rhsindex] = value;
}
-NLfloat nlGetVariable(NLuint index) {
+NLfloat nlGetVariable(NLuint rhsindex, NLuint index) {
__nl_assert(__nlCurrentContext->state != __NL_STATE_INITIAL);
__nl_parano_range_assert(index, 0, __nlCurrentContext->nb_variables - 1);
- return __nlCurrentContext->variable[index].value;
+ return __nlCurrentContext->variable[index].value[rhsindex];
}
void nlLockVariable(NLuint index) {
@@ -726,27 +781,41 @@ NLboolean nlVariableIsLocked(NLuint index) {
/* System construction */
static void __nlVariablesToVector() {
- NLuint i;
- __nl_assert(__nlCurrentContext->alloc_x);
- __nl_assert(__nlCurrentContext->alloc_variable);
- for(i=0; i<__nlCurrentContext->nb_variables; i++) {
- __NLVariable* v = &(__nlCurrentContext->variable[i]);
+ __NLContext *context = __nlCurrentContext;
+ NLuint i, j, nb_rhs;
+
+ __nl_assert(context->alloc_x);
+ __nl_assert(context->alloc_variable);
+
+ nb_rhs= context->nb_rhs;
+
+ for(i=0; i<context->nb_variables; i++) {
+ __NLVariable* v = &(context->variable[i]);
if(!v->locked) {
- __nl_assert(v->index < __nlCurrentContext->n);
- __nlCurrentContext->x[v->index] = v->value;
+ __nl_assert(v->index < context->n);
+
+ for(j=0; j<nb_rhs; j++)
+ context->x[context->n*j + v->index] = v->value[j];
}
}
}
static void __nlVectorToVariables() {
- NLuint i;
- __nl_assert(__nlCurrentContext->alloc_x);
- __nl_assert(__nlCurrentContext->alloc_variable);
- for(i=0; i<__nlCurrentContext->nb_variables; i++) {
- __NLVariable* v = &(__nlCurrentContext->variable[i]);
+ __NLContext *context = __nlCurrentContext;
+ NLuint i, j, nb_rhs;
+
+ __nl_assert(context->alloc_x);
+ __nl_assert(context->alloc_variable);
+
+ nb_rhs= context->nb_rhs;
+
+ for(i=0; i<context->nb_variables; i++) {
+ __NLVariable* v = &(context->variable[i]);
if(!v->locked) {
- __nl_assert(v->index < __nlCurrentContext->n);
- v->value = __nlCurrentContext->x[v->index];
+ __nl_assert(v->index < context->n);
+
+ for(j=0; j<nb_rhs; j++)
+ v->value[j] = context->x[context->n*j + v->index];
}
}
}
@@ -760,8 +829,8 @@ static void __nlBeginSystem() {
__nlTransition(__NL_STATE_INITIAL, __NL_STATE_SYSTEM);
__nlCurrentContext->variable = __NL_NEW_ARRAY(
- __NLVariable, __nlCurrentContext->nb_variables
- );
+ __NLVariable, __nlCurrentContext->nb_variables);
+
__nlCurrentContext->alloc_variable = NL_TRUE;
}
}
@@ -772,159 +841,161 @@ static void __nlEndSystem() {
static void __nlBeginMatrix() {
NLuint i;
- NLuint n = 0;
+ NLuint m = 0, n = 0;
NLenum storage = __NL_ROWS;
+ __NLContext *context = __nlCurrentContext;
__nlTransition(__NL_STATE_SYSTEM, __NL_STATE_MATRIX);
- if (!__nlCurrentContext->solve_again) {
- for(i=0; i<__nlCurrentContext->nb_variables; i++) {
- if(!__nlCurrentContext->variable[i].locked)
- __nlCurrentContext->variable[i].index = n++;
+ if (!context->solve_again) {
+ for(i=0; i<context->nb_variables; i++) {
+ if(context->variable[i].locked) {
+ context->variable[i].index = ~0;
+ context->variable[i].a = __NL_NEW(__NLRowColumn);
+ __nlRowColumnConstruct(context->variable[i].a);
+ }
else
- __nlCurrentContext->variable[i].index = ~0;
+ context->variable[i].index = n++;
}
- __nlCurrentContext->n = n;
+ m = (context->nb_rows == 0)? n: context->nb_rows;
- /* a least squares problem results in a symmetric matrix */
- if(__nlCurrentContext->least_squares)
- __nlCurrentContext->symmetric = NL_TRUE;
+ context->m = m;
+ context->n = n;
- if(__nlCurrentContext->symmetric)
- storage = (storage | __NL_SYMMETRIC);
+ __nlSparseMatrixConstruct(&context->M, m, n, storage);
+ context->alloc_M = NL_TRUE;
- /* SuperLU storage does not support symmetric storage */
- storage = (storage & ~__NL_SYMMETRIC);
+ context->b = __NL_NEW_ARRAY(NLfloat, m*context->nb_rhs);
+ context->alloc_b = NL_TRUE;
- __nlSparseMatrixConstruct(&__nlCurrentContext->M, n, n, storage);
- __nlCurrentContext->alloc_M = NL_TRUE;
-
- __nlCurrentContext->x = __NL_NEW_ARRAY(NLfloat, n);
- __nlCurrentContext->alloc_x = NL_TRUE;
-
- __nlCurrentContext->b = __NL_NEW_ARRAY(NLfloat, n);
- __nlCurrentContext->alloc_b = NL_TRUE;
+ context->x = __NL_NEW_ARRAY(NLfloat, n*context->nb_rhs);
+ context->alloc_x = NL_TRUE;
}
else {
/* need to recompute b only, A is not constructed anymore */
- __NL_CLEAR_ARRAY(NLfloat, __nlCurrentContext->b, __nlCurrentContext->n);
+ __NL_CLEAR_ARRAY(NLfloat, context->b, context->m*context->nb_rhs);
}
__nlVariablesToVector();
+}
+
+static void __nlEndMatrixRHS(NLuint rhs) {
+ __NLContext *context = __nlCurrentContext;
+ __NLVariable *variable;
+ __NLRowColumn *a;
+ NLfloat *b, *Mtb;
+ NLuint i, j;
+
+ b = context->b + context->m*rhs;
+ Mtb = context->Mtb + context->n*rhs;
+
+ for(i=0; i<__nlCurrentContext->nb_variables; i++) {
+ variable = &(context->variable[i]);
- __nlRowColumnConstruct(&__nlCurrentContext->af);
- __nlCurrentContext->alloc_af = NL_TRUE;
- __nlRowColumnConstruct(&__nlCurrentContext->al);
- __nlCurrentContext->alloc_al = NL_TRUE;
+ if(variable->locked) {
+ a = variable->a;
- __nlCurrentContext->current_row = 0;
+ for(j=0; j<a->size; j++) {
+ b[a->coeff[j].index] -= a->coeff[j].value*variable->value[rhs];
+ }
+ }
+ }
+
+ if(context->least_squares)
+ __nlSparseMatrix_transpose_mult_rows(&context->M, b, Mtb);
}
static void __nlEndMatrix() {
+ __NLContext *context = __nlCurrentContext;
+ NLuint i;
+
__nlTransition(__NL_STATE_MATRIX, __NL_STATE_MATRIX_CONSTRUCTED);
- __nlRowColumnDestroy(&__nlCurrentContext->af);
- __nlCurrentContext->alloc_af = NL_FALSE;
- __nlRowColumnDestroy(&__nlCurrentContext->al);
- __nlCurrentContext->alloc_al = NL_FALSE;
-
-#if 0
- if(!__nlCurrentContext->least_squares) {
- __nl_assert(
- __nlCurrentContext->current_row ==
- __nlCurrentContext->n
- );
+ if(context->least_squares) {
+ if(!__nlCurrentContext->solve_again) {
+ __nlSparseMatrix_square(&context->MtM, &context->M);
+ context->alloc_MtM = NL_TRUE;
+
+ context->Mtb =
+ __NL_NEW_ARRAY(NLfloat, context->n*context->nb_rhs);
+ context->alloc_Mtb = NL_TRUE;
+ }
}
-#endif
-}
-static void __nlBeginRow() {
- __nlTransition(__NL_STATE_MATRIX, __NL_STATE_ROW);
- __nlRowColumnZero(&__nlCurrentContext->af);
- __nlRowColumnZero(&__nlCurrentContext->al);
+ for(i=0; i<context->nb_rhs; i++)
+ __nlEndMatrixRHS(i);
}
-static void __nlEndRow() {
- __NLRowColumn* af = &__nlCurrentContext->af;
- __NLRowColumn* al = &__nlCurrentContext->al;
- __NLSparseMatrix* M = &__nlCurrentContext->M;
- NLfloat* b = __nlCurrentContext->b;
- NLuint nf = af->size;
- NLuint nl = al->size;
- NLuint current_row = __nlCurrentContext->current_row;
- NLuint i;
- NLuint j;
- NLfloat S;
- __nlTransition(__NL_STATE_ROW, __NL_STATE_MATRIX);
-
- if(__nlCurrentContext->least_squares) {
- if (!__nlCurrentContext->solve_again) {
- for(i=0; i<nf; i++) {
- for(j=0; j<nf; j++) {
- __nlSparseMatrixAdd(
- M, af->coeff[i].index, af->coeff[j].index,
- af->coeff[i].value * af->coeff[j].value
- );
- }
- }
- }
+void nlMatrixAdd(NLuint row, NLuint col, NLfloat value)
+{
+ __NLContext *context = __nlCurrentContext;
- S = -__nlCurrentContext->right_hand_side;
- for(j=0; j<nl; j++)
- S += al->coeff[j].value;
+ __nlCheckState(__NL_STATE_MATRIX);
- for(i=0; i<nf; i++)
- b[ af->coeff[i].index ] -= af->coeff[i].value * S;
- } else {
- if (!__nlCurrentContext->solve_again) {
- for(i=0; i<nf; i++) {
- __nlSparseMatrixAdd(
- M, current_row, af->coeff[i].index, af->coeff[i].value
- );
- }
- }
- b[current_row] = -__nlCurrentContext->right_hand_side;
- for(i=0; i<nl; i++) {
- b[current_row] -= al->coeff[i].value;
- }
+ if(context->solve_again)
+ return;
+
+ if (!context->least_squares && context->variable[row].locked);
+ else if (context->variable[col].locked) {
+ if(!context->least_squares)
+ row = context->variable[row].index;
+ __nlRowColumnAppend(context->variable[col].a, row, value);
+ }
+ else {
+ __NLSparseMatrix* M = &context->M;
+
+ if(!context->least_squares)
+ row = context->variable[row].index;
+ col = context->variable[col].index;
+
+ __nl_range_assert(row, 0, context->m - 1);
+ __nl_range_assert(col, 0, context->n - 1);
+
+ __nlSparseMatrixAdd(M, row, col, value);
}
- __nlCurrentContext->current_row++;
- __nlCurrentContext->right_hand_side = 0.0;
}
-void nlMatrixAdd(NLuint row, NLuint col, NLfloat value)
+void nlRightHandSideAdd(NLuint rhsindex, NLuint index, NLfloat value)
{
- __NLSparseMatrix* M = &__nlCurrentContext->M;
+ __NLContext *context = __nlCurrentContext;
+ NLfloat* b = context->b;
+
__nlCheckState(__NL_STATE_MATRIX);
- __nl_range_assert(row, 0, __nlCurrentContext->n - 1);
- __nl_range_assert(col, 0, __nlCurrentContext->nb_variables - 1);
- __nl_assert(!__nlCurrentContext->least_squares);
- __nlSparseMatrixAdd(M, row, col, value);
+ if(context->least_squares) {
+ __nl_range_assert(index, 0, context->m - 1);
+ b[rhsindex*context->m + index] += value;
+ }
+ else {
+ if(!context->variable[index].locked) {
+ index = context->variable[index].index;
+ __nl_range_assert(index, 0, context->m - 1);
+
+ b[rhsindex*context->m + index] += value;
+ }
+ }
}
-void nlRightHandSideAdd(NLuint index, NLfloat value)
+void nlRightHandSideSet(NLuint rhsindex, NLuint index, NLfloat value)
{
- NLfloat* b = __nlCurrentContext->b;
+ __NLContext *context = __nlCurrentContext;
+ NLfloat* b = context->b;
__nlCheckState(__NL_STATE_MATRIX);
- __nl_range_assert(index, 0, __nlCurrentContext->n - 1);
- __nl_assert(!__nlCurrentContext->least_squares);
- b[index] += value;
-}
+ if(context->least_squares) {
+ __nl_range_assert(index, 0, context->m - 1);
+ b[rhsindex*context->m + index] = value;
+ }
+ else {
+ if(!context->variable[index].locked) {
+ index = context->variable[index].index;
+ __nl_range_assert(index, 0, context->m - 1);
-void nlCoefficient(NLuint index, NLfloat value) {
- __NLVariable* v;
- unsigned int zero= 0;
- __nlCheckState(__NL_STATE_ROW);
- __nl_range_assert(index, zero, __nlCurrentContext->nb_variables - 1);
- v = &(__nlCurrentContext->variable[index]);
- if(v->locked)
- __nlRowColumnAppend(&(__nlCurrentContext->al), 0, value*v->value);
- else
- __nlRowColumnAppend(&(__nlCurrentContext->af), v->index, value);
+ b[rhsindex*context->m + index] = value;
+ }
+ }
}
void nlBegin(NLenum prim) {
@@ -935,9 +1006,6 @@ void nlBegin(NLenum prim) {
case NL_MATRIX: {
__nlBeginMatrix();
} break;
- case NL_ROW: {
- __nlBeginRow();
- } break;
default: {
__nl_assert_not_reached;
}
@@ -952,9 +1020,6 @@ void nlEnd(NLenum prim) {
case NL_MATRIX: {
__nlEndMatrix();
} break;
- case NL_ROW: {
- __nlEndRow();
- } break;
default: {
__nl_assert_not_reached;
}
@@ -969,7 +1034,7 @@ void nlEnd(NLenum prim) {
static NLboolean __nlFactorize_SUPERLU(__NLContext *context, NLint *permutation) {
/* OpenNL Context */
- __NLSparseMatrix* M = &(context->M);
+ __NLSparseMatrix* M = (context->least_squares)? &context->MtM: &context->M;
NLuint n = context->n;
NLuint nnz = __nlSparseMatrixNNZ(M); /* number of non-zero coeffs */
@@ -986,7 +1051,6 @@ static NLboolean __nlFactorize_SUPERLU(__NLContext *context, NLint *permutation)
superlu_options_t options;
/* Temporary variables */
- __NLRowColumn* Ri = NULL;
NLuint i, jj, count;
__nl_assert(!(M->storage & __NL_SYMMETRIC));
@@ -1049,7 +1113,7 @@ static NLboolean __nlFactorize_SUPERLU(__NLContext *context, NLint *permutation)
/* Cleanup */
Destroy_SuperMatrix_Store(&At);
- Destroy_SuperMatrix_Store(&AtP);
+ Destroy_CompCol_Permuted(&AtP);
__NL_DELETE_ARRAY(etree);
__NL_DELETE_ARRAY(xa);
@@ -1065,31 +1129,33 @@ static NLboolean __nlFactorize_SUPERLU(__NLContext *context, NLint *permutation)
static NLboolean __nlInvert_SUPERLU(__NLContext *context) {
/* OpenNL Context */
- NLfloat* b = context->b;
+ NLfloat* b = (context->least_squares)? context->Mtb: context->b;
NLfloat* x = context->x;
- NLuint n = context->n;
+ NLuint n = context->n, j;
/* SuperLU variables */
SuperMatrix B;
NLint info;
- /* Create superlu array for B */
- sCreate_Dense_Matrix(
- &B, n, 1, b, n,
- SLU_DN, /* Fortran-type column-wise storage */
- SLU_S, /* floats */
- SLU_GE /* general */
- );
+ for(j=0; j<context->nb_rhs; j++, b+=n, x+=n) {
+ /* Create superlu array for B */
+ sCreate_Dense_Matrix(
+ &B, n, 1, b, n,
+ SLU_DN, /* Fortran-type column-wise storage */
+ SLU_S, /* floats */
+ SLU_GE /* general */
+ );
- /* Forward/Back substitution to compute x */
- sgstrs(TRANS, &(context->slu.L), &(context->slu.U),
- context->slu.perm_c, context->slu.perm_r, &B,
- &(context->slu.stat), &info);
+ /* Forward/Back substitution to compute x */
+ sgstrs(TRANS, &(context->slu.L), &(context->slu.U),
+ context->slu.perm_c, context->slu.perm_r, &B,
+ &(context->slu.stat), &info);
- if(info == 0)
- memcpy(x, ((DNformat*)B.Store)->nzval, sizeof(*x)*n);
+ if(info == 0)
+ memcpy(x, ((DNformat*)B.Store)->nzval, sizeof(*x)*n);
- Destroy_SuperMatrix_Store(&B);
+ Destroy_SuperMatrix_Store(&B);
+ }
return (info == 0);
}
@@ -1108,15 +1174,18 @@ static void __nlFree_SUPERLU(__NLContext *context) {
}
void nlPrintMatrix(void) {
- __NLSparseMatrix* M = &(__nlCurrentContext->M);
- float *b = __nlCurrentContext->b;
+ __NLContext *context = __nlCurrentContext;
+ __NLSparseMatrix* M = &(context->M);
+ __NLSparseMatrix* MtM = &(context->MtM);
+ float *b = context->b;
NLuint i, jj, k;
- NLuint n = __nlCurrentContext->n;
+ NLuint m = context->m;
+ NLuint n = context->n;
__NLRowColumn* Ri = NULL;
- float *value = malloc(sizeof(*value)*n);
+ float *value = malloc(sizeof(*value)*(n+m));
printf("A:\n");
- for(i=0; i<n; i++) {
+ for(i=0; i<m; i++) {
Ri = &(M->row[i]);
memset(value, 0.0, sizeof(*value)*n);
@@ -1128,10 +1197,35 @@ void nlPrintMatrix(void) {
printf("\n");
}
- printf("b:\n");
- for(i=0; i<n; i++)
- printf("%f ", b[i]);
- printf("\n");
+ for(k=0; k<context->nb_rhs; k++) {
+ printf("b (%d):\n", k);
+ for(i=0; i<n; i++)
+ printf("%f ", b[context->n*k + i]);
+ printf("\n");
+ }
+
+ if(context->alloc_MtM) {
+ printf("AtA:\n");
+ for(i=0; i<n; i++) {
+ Ri = &(MtM->row[i]);
+
+ memset(value, 0.0, sizeof(*value)*m);
+ for(jj=0; jj<Ri->size; jj++)
+ value[Ri->coeff[jj].index] = Ri->coeff[jj].value;
+
+ for (k = 0; k<n; k++)
+ printf("%.3f ", value[k]);
+ printf("\n");
+ }
+
+ for(k=0; k<context->nb_rhs; k++) {
+ printf("Mtb (%d):\n", k);
+ for(i=0; i<n; i++)
+ printf("%f ", context->Mtb[context->n*k + i]);
+ printf("\n");
+ }
+ printf("\n");
+ }
free(value);
}
diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h
index 2da2b57c6f2..7b02e6c1855 100644
--- a/intern/string/STR_String.h
+++ b/intern/string/STR_String.h
@@ -47,6 +47,10 @@
#include <vector>
#include <limits.h>
+
+#include <cstring>
+#include <cstdlib>
+
using namespace std;
diff --git a/intern/string/intern/STR_String.cpp b/intern/string/intern/STR_String.cpp
index c243bc28224..af8f0d11445 100644
--- a/intern/string/intern/STR_String.cpp
+++ b/intern/string/intern/STR_String.cpp
@@ -41,6 +41,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
#include "STR_String.h"
/*-------------------------------------------------------------------------------------------------