forked from bartvdbraak/blender
Just cleaning up dirs no longer in use.
Kent
This commit is contained in:
parent
83c65e71e8
commit
dcc8022095
@ -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_
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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/
|
||||
|
@ -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 =
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -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
|
@ -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>
|
@ -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;
|
||||
}
|
@ -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));
|
||||
}
|
@ -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_
|
||||
|
@ -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
|
@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -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;
|
||||
}
|
@ -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
|
||||
|
@ -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
|
@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -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)
|
434
intern/csg/extern/CSG_Interface.h
vendored
434
intern/csg/extern/CSG_Interface.h
vendored
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
@ -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
|
@ -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;
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -1,4 +0,0 @@
|
||||
#include "CSG_SimpleProp.h"
|
||||
|
||||
|
||||
int SimpleProp::s_size = 4;
|
@ -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
|
@ -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
|
@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -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
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
@ -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
|
@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -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
|
@ -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>
|
@ -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");
|
||||
}
|
||||
}
|
||||
*/
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user