As mentioned earlier on bf-commiters mailing list, there is no current *nix make file only an msvc60 project file. I only have a linux box at work and to be honest I want to avoid doing any commits from there! So if some kind soul could sort it out that would be great. Dependencies: This code only depends on other stuff in the intern library, moto and memutils the CSG lib needs to have their include paths to compile. Other than that its completely self contained. Acknowledgements: To speed up the polygon-polygon intersection queries I've used some code (under the GPL) from freesolid2.0 this clearly marked in the appropriate files and Gino van den Bergen still owns the copyright to that material. The algorithm I used in based on one from Paul Nettle described on flipcode (www.flipcode.com) and I think his work was a derivative of the "Laidlaw algorithm" There is also some basic 'ear clipping' triangulation code that unfortunately remains unatributable. I have no right to publish this code under the GPL nor BPL for that matter as I have no idea who the original authors are. Its just one of those random bits of internet code. Warning! The stuff used a lot of C++ template features, which on one hand makes it very generic but on the other means that some work will need to be done to get working with other compilters. The msvc60 compiler is not very compliant to the C++ standards with respect to templates so its very difficult to say if this code will compile out of the box on other platforms. I still haven't committed modifications to booleanops.c in the blender code as without a working library to link to it will break the current build. This needs to be done first! Improvements This code is much simpler than the previous bsp implementation see intern/bsp and this old code should be deprectated/removed. However, whilst this implementation produces less triangles in the output than the bps algo, its still not an optimal solution. This is just hard to do and beyond my humble skills. License: Just to make it clear this stuff for the reasons mentioned above and for the fact I'm to mean to give the copyright away to BF is licensed under the GPL only. Cheers, Laurence.
94 lines
2.2 KiB
C++
94 lines
2.2 KiB
C++
#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 |