[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12022] branches/nurbs/blender: Added libNurbana and modifications to Blender to use libNurbana.

Emmanuel Stone emmanuel.stone at gmail.com
Wed Sep 12 08:11:28 CEST 2007


Revision: 12022
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12022
Author:   eman
Date:     2007-09-12 08:11:28 +0200 (Wed, 12 Sep 2007)

Log Message:
-----------
Added libNurbana and modifications to Blender to use libNurbana.

-- Warning -- 

This should compile using CMake and XCode but I have not added neither NaN Makefiles nor Scons files nor have I tested on other platforms.

This code should be considered early alpha! 
I intend to release a 'tech preview' alpha build in the near future when I have ironed out some bugs. Until then it isn't really fit for general consumption.

-- Summary --

libNurbana has been almost completely re-factored since SoC.
The new version is much more blender-centric, does not duplicate data, and is/will be completely backwards compatible with legacy Blender NURBS.

The bulk of the code at the moment merely re-implements existing Blender functionality but the following features are present and at least partially complete/functioning:
 
 - Isolines
 - Non-destructive subdivision 

New functionality should be quick to add from existing libNurbana code, once the current code is stable. I have committed all libNurbana code, even that which has not be re-factored, the currently relevant classes are mainly:

Object_Base, Object_NURBS, NURBS_Generate and NURBS_Knot. 

The C interface lives in nurbana.h

-- Bugs --

There are bugs. I have seen them, if you build this development branch, please do not be surprised by bugs. I would appreciate if people could report bugs directly to me at this email address. A stacktrace is always helpful if available, and a reproduction case is nearly always necessary.

Bugs I am aware of:

- 2D NURBS do not handle 'alfa' or twist correctly yet
- NURBS curves with Bezier Knots and of Order 4 seem to be borked
- Bevel/Extrude is nutso, no idea why yet.
- Subdivision of cyclical curves/surfaces and/or periodic knots is broken. Use 'end point' curves/surfaces for best results.

Other things of note:

- Incremental calculations are currently disabled, therefore libNurbana is likely to be much slower than it should be
- The code is a mess currently, commented out sections, abandoned code, temporary crap. etc
  I will remove this shortly

Modified Paths:
--------------
    branches/nurbs/blender/intern/CMakeLists.txt
    branches/nurbs/blender/source/blender/blenkernel/BKE_curve.h
    branches/nurbs/blender/source/blender/blenkernel/BKE_displist.h
    branches/nurbs/blender/source/blender/blenkernel/CMakeLists.txt
    branches/nurbs/blender/source/blender/blenkernel/intern/curve.c
    branches/nurbs/blender/source/blender/blenkernel/intern/displist.c
    branches/nurbs/blender/source/blender/blenloader/intern/readfile.c
    branches/nurbs/blender/source/blender/include/butspace.h
    branches/nurbs/blender/source/blender/makesdna/DNA_curve_types.h
    branches/nurbs/blender/source/blender/src/buttons_editing.c
    branches/nurbs/blender/source/blender/src/drawobject.c
    branches/nurbs/blender/source/blender/src/editcurve.c
    branches/nurbs/blender/source/creator/CMakeLists.txt

Added Paths:
-----------
    branches/nurbs/blender/intern/nurbana/CMakeLists.txt
    branches/nurbs/blender/intern/nurbana/extern/
    branches/nurbs/blender/intern/nurbana/extern/nurbana.h
    branches/nurbs/blender/intern/nurbana/intern/
    branches/nurbs/blender/intern/nurbana/intern/Makefile
    branches/nurbs/blender/intern/nurbana/intern/NGlobal.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Construct.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Construct.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Degree.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Degree.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Fitting.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Fitting.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.h
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Knot.cpp
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Knot.h
    branches/nurbs/blender/intern/nurbana/intern/Nurbana.cpp
    branches/nurbs/blender/intern/nurbana/intern/NurbanaMath.cpp
    branches/nurbs/blender/intern/nurbana/intern/NurbanaMath.h
    branches/nurbs/blender/intern/nurbana/intern/Object_Base.cpp
    branches/nurbs/blender/intern/nurbana/intern/Object_Base.h
    branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.cpp
    branches/nurbs/blender/intern/nurbana/intern/Object_NURBS.h
    branches/nurbs/blender/intern/nurbana/intern/Object_Normals.cpp
    branches/nurbs/blender/intern/nurbana/intern/Object_Normals.h
    branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.cpp
    branches/nurbs/blender/intern/nurbana/intern/Object_Primitives.h
    branches/nurbs/blender/intern/nurbana/intern/VertexOps.cpp
    branches/nurbs/blender/intern/nurbana/intern/VertexOps.h
    branches/nurbs/blender/intern/nurbana/intern/libNurbana.cpp

Modified: branches/nurbs/blender/intern/CMakeLists.txt
===================================================================
--- branches/nurbs/blender/intern/CMakeLists.txt	2007-09-12 05:32:57 UTC (rev 12021)
+++ branches/nurbs/blender/intern/CMakeLists.txt	2007-09-12 06:11:28 UTC (rev 12022)
@@ -27,7 +27,7 @@
 #
 # ***** END GPL/BL DUAL LICENSE BLOCK *****
 
-SUBDIRS(SoundSystem string ghost guardedalloc bmfont moto container memutil decimation iksolver boolop opennl)
+SUBDIRS(SoundSystem string ghost guardedalloc bmfont moto container memutil decimation iksolver boolop opennl nurbana)
 
 IF(WITH_ELBEEM)
   SUBDIRS(elbeem)

Added: branches/nurbs/blender/intern/nurbana/CMakeLists.txt
===================================================================
--- branches/nurbs/blender/intern/nurbana/CMakeLists.txt	                        (rev 0)
+++ branches/nurbs/blender/intern/nurbana/CMakeLists.txt	2007-09-12 06:11:28 UTC (rev 12022)
@@ -0,0 +1,35 @@
+# ***** 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) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Emmanuel Stone.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+
+SET(INC include)
+
+FILE(GLOB SRC intern/*.cpp)
+
+INCLUDE_DIRECTORIES(../../intern/guardedalloc)
+BLENDERLIB(bf_nurbana "${SRC}" "${INC}")
+#, libtype=['intern','game','game2','player'], priority = [15, 55, 100, 135] )


Property changes on: branches/nurbs/blender/intern/nurbana/CMakeLists.txt
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/nurbs/blender/intern/nurbana/extern/nurbana.h
===================================================================
--- branches/nurbs/blender/intern/nurbana/extern/nurbana.h	                        (rev 0)
+++ branches/nurbs/blender/intern/nurbana/extern/nurbana.h	2007-09-12 06:11:28 UTC (rev 12022)
@@ -0,0 +1,151 @@
+/*
+* $Id$
+*
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software  Foundation,
+* Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*
+* The Original Code is Copyright (C) 2005 by Emmanuel Stone
+* All rights reserved.
+*
+* The Original Code is: all of this file.
+*
+* Contributor(s): none yet.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
+
+#ifndef NAN_INCLUDED_nurbana_h
+#define NAN_INCLUDED_nurbana_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void nurbs_test();
+
+typedef float nbReal;
+
+//typedef struct Point3d {
+//    nbReal  x;  
+//    nbReal  y;
+//    nbReal  z;
+//}Point3d;
+typedef struct nbReal3 {
+	nbReal  x;  
+	nbReal  y;
+	nbReal  z;
+	
+	// This extra data should make Point4d 'struct'rally equivalent to BPoint from Blender::DNA_Data_Types.h
+//	float alfa, weight;		/* alfa: tilt in 3D View, weight: used for softbody goal weight */
+	//short f1, hide;
+}nbReal3;
+
+
+typedef struct Point3d {
+	nbReal  x;  
+	nbReal  y;
+	nbReal  z;
+	nbReal  H;
+	
+	// This extra data should make Point4d 'struct'rally equivalent to BPoint from Blender::DNA_Data_Types.h
+	float alfa, weight;		/* alfa: tilt in 3D View, weight: used for softbody goal weight */
+	short f1, hide;
+	float radius, pad;		/* user-set radius per point for bevelling etc */
+}Point3d;
+
+//typedef Point3d nbReal3;
+
+typedef struct Nurb_Extern {
+   int numCPu;
+	int numCPv;
+	int resolu;
+	int resolv;
+	short cyclicU;
+	short cyclicV;
+	short orderU;
+	short orderV;
+	int numKnotsU;
+	int numKnotsV;
+	nbReal *KnotU;
+	nbReal *KnotV;
+	struct ControlPoint *CP;	
+} Nurb_Extern;
+
+typedef struct ControlPoint {
+	nbReal x;
+	nbReal y;
+	nbReal z;
+	nbReal H;
+	// This extra data makes nurbana struct compatible with blender
+	float alfa, weight;		/* alfa: tilt in 3D View, weight: used for softbody goal weight */
+	short f1, hide;
+	float radius, pad;		/* user-set radius per point for bevelling etc */
+} ControlPoint;
+
+
+typedef Nurb_Extern* Nurb_ExternPtr;
+typedef Point3d* Point3d_ptr;
+typedef nbReal3* nbReal3_ptr;
+typedef void* NurbanaObj_ptr; // to hide pointer to C++ object in C space
+
+extern NurbanaObj_ptr NRB_addObject(Point3d** CtlPts, short* numCPu, short* numCPv, short* orderU, short* orderV, nbReal** knotsU, nbReal** knotsV,  short* cyclicU,  short* cyclicV, short* knottypeu, short* knottypev,  short* resolu,  short* resolv, short* isores, short* isoden) ;
+
+extern NurbanaObj_ptr NRB_CreatePrimitive(unsigned char type);
+extern void NRB_removeObject(NurbanaObj_ptr nop);
+
+extern void NRB_changeCyclic(NurbanaObj_ptr nop,int uv); 
+
+extern void NRB_ConvertToPrimitive(NurbanaObj_ptr nop,unsigned char type);
+
+extern void NRB_RecalculateKnots(NurbanaObj_ptr nop,int uv,int type); 
+
+extern Nurb_ExternPtr NRB_getNurbData(NurbanaObj_ptr nop);
+
+extern void NRB_freeNurbData(Nurb_ExternPtr ne);
+extern void NRB_updateNurbData(Nurb_ExternPtr ne,NurbanaObj_ptr nop);
+
+extern int NRB_getNumTessPoints(NurbanaObj_ptr nurb);
+extern int NRB_getNumCPoints(int uv,NurbanaObj_ptr nurb);
+extern int NRB_getOrder(int uv,NurbanaObj_ptr nurb);
+extern int NRB_getNumKnots(int uv,NurbanaObj_ptr nurb);
+
+extern int NRB_getNumIsoPoints(NurbanaObj_ptr nop);
+extern int NRB_getIsoResolution(NurbanaObj_ptr nop);
+extern int NRB_getIsoDensity(NurbanaObj_ptr nop);
+extern void NRB_setIsoResolution(NurbanaObj_ptr nop,int res);
+extern void NRB_setIsoDensity(NurbanaObj_ptr nop,int den);
+extern nbReal3_ptr NRB_getIsoPoints(NurbanaObj_ptr nop, nbReal3* buffer);
+
+extern nbReal3_ptr NRB_GenerateSurface(NurbanaObj_ptr nop, nbReal3* buffer);
+extern nbReal3_ptr NRB_GenerateNormals(NurbanaObj_ptr nop);
+
+extern void NRB_Subdivide(NurbanaObj_ptr nop,nbReal subdividePositionU, nbReal subdividePositionV);
+
+extern void NRB_Print(NurbanaObj_ptr nop);
+
+extern void NRB_Echo();
+
+#define  NURBANA_PRIMITIVE_CURVE     0
+#define  NURBANA_PRIMITIVE_SURFACE   1
+#define  NURBANA_PRIMITIVE_CIRCLE    2
+#define NURBANA_PRIMITIVE_TUBE    3
+#define NURBANA_PRIMITIVE_TORUS      4
+#define  NURBANA_PRIMITIVE_SPHERE    5
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NAN_INCLUDED_nurbana_h


Property changes on: branches/nurbs/blender/intern/nurbana/extern/nurbana.h
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/nurbs/blender/intern/nurbana/intern/Makefile
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/Makefile	                        (rev 0)
+++ branches/nurbs/blender/intern/nurbana/intern/Makefile	2007-09-12 06:11:28 UTC (rev 12022)
@@ -0,0 +1,43 @@
+#
+# $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 *****
+# iksolver intern Makefile
+#
+LIBNAME = nurbana
+DIR = $(OCGDIR)/intern/$(LIBNAME)
+CCSRCS = NURBS.cpp NURBS_Construct.cpp NURBS_Degree.cpp NURBS_Fitting.cpp NURBS_Generate.cpp NURBS_Knot.cpp NurbanaMath.cpp Object_Base.cpp Object_Normals.cpp Object_NURBS.cpp Object_Primitives.cpp VertexOps.cpp libNurbana.cpp
+include nan_compile.mk
+
+CCFLAGS += $(LEVEL_2_CPP_WARNINGS)
+
+CPPFLAGS += -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_MEMUTIL)/include
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+


Property changes on: branches/nurbs/blender/intern/nurbana/intern/Makefile
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/nurbs/blender/intern/nurbana/intern/NGlobal.h
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/NGlobal.h	                        (rev 0)
+++ branches/nurbs/blender/intern/nurbana/intern/NGlobal.h	2007-09-12 06:11:28 UTC (rev 12022)
@@ -0,0 +1,12 @@
+// Struct for All 3d Points
+#ifndef NGLOBAL_H
+#define NGLOBAL_H
+/*  struct Point3d {
+    nbReal	x;
+    nbReal	y;
+    nbReal	z;
+  };*/
+#include "../extern/nurbana.h"
+
+
+#endif



@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list