[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16009] branches/apricot: svn merge -r15983:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/ blender

Campbell Barton ideasman42 at gmail.com
Thu Aug 7 22:00:58 CEST 2008


Revision: 16009
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16009
Author:   campbellbarton
Date:     2008-08-07 22:00:58 +0200 (Thu, 07 Aug 2008)

Log Message:
-----------
svn merge -r15983:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender

Modified Paths:
--------------
    branches/apricot/CMakeLists.txt
    branches/apricot/config/linux2-config.py
    branches/apricot/release/scripts/flt_export.py
    branches/apricot/source/blender/blenkernel/intern/texture.c
    branches/apricot/source/blender/blenlib/BLI_kdopbvh.h
    branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c
    branches/apricot/source/blender/include/BIF_editmesh.h
    branches/apricot/source/blender/include/butspace.h
    branches/apricot/source/blender/python/api2_2x/doc/Render.py
    branches/apricot/source/blender/src/buttons_editing.c
    branches/apricot/source/blender/src/editmesh_mods.c
    branches/apricot/source/gameengine/Converter/KX_IpoConvert.cpp
    branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
    branches/apricot/source/gameengine/Ketsji/CMakeLists.txt
    branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
    branches/apricot/source/gameengine/Ketsji/KX_RadarSensor.cpp
    branches/apricot/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Added Paths:
-----------
    branches/apricot/source/blender/blenkernel/BKE_bvhutils.h
    branches/apricot/source/blender/blenkernel/intern/bvhutils.c

Modified: branches/apricot/CMakeLists.txt
===================================================================
--- branches/apricot/CMakeLists.txt	2008-08-07 18:01:39 UTC (rev 16008)
+++ branches/apricot/CMakeLists.txt	2008-08-07 20:00:58 UTC (rev 16009)
@@ -183,9 +183,9 @@
   SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
 
   IF(WITH_OPENMP)
-    SET(LLIBS "${LLIBS} -lgomp ")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
+    SET(LLIBS "${LLIBS} -lgomp")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
   ENDIF(WITH_OPENMP)
 
   SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")

Modified: branches/apricot/config/linux2-config.py
===================================================================
--- branches/apricot/config/linux2-config.py	2008-08-07 18:01:39 UTC (rev 16008)
+++ branches/apricot/config/linux2-config.py	2008-08-07 20:00:58 UTC (rev 16009)
@@ -139,7 +139,7 @@
 BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
-WITH_BF_REDCODE = 'true'  
+WITH_BF_REDCODE = 'false'  
 BF_REDCODE = '#extern/libredcode'
 BF_REDCODE_LIB = ''
 # Uncomment the following two lines to use system's ffmpeg

Modified: branches/apricot/release/scripts/flt_export.py
===================================================================
--- branches/apricot/release/scripts/flt_export.py	2008-08-07 18:01:39 UTC (rev 16008)
+++ branches/apricot/release/scripts/flt_export.py	2008-08-07 20:00:58 UTC (rev 16009)
@@ -1070,7 +1070,7 @@
 
                 if self.opcode == 63 and options.state['externalspath']:
 				try:
-					exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt')
+					exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt').replace("\\", "/")
 					self.header.xrefnames.append(self.object.DupGroup.name)
 				except:
 					pass
@@ -1199,7 +1199,7 @@
 			print 'Writing texture palette.'
 		# Write record for texture palette
 		for i, img in enumerate(self.GRR.texture_lst):
-			filename = tex_files[img.name]
+			filename = tex_files[img.name].replace("\\", "/")
 			self.fw.write_short(64)                                         # Texture palette opcode.
 			self.fw.write_short(216)                                        # Length of record
 			self.fw.write_string(filename, 200) # Filename

Copied: branches/apricot/source/blender/blenkernel/BKE_bvhutils.h (from rev 16008, trunk/blender/source/blender/blenkernel/BKE_bvhutils.h)
===================================================================
--- branches/apricot/source/blender/blenkernel/BKE_bvhutils.h	                        (rev 0)
+++ branches/apricot/source/blender/blenkernel/BKE_bvhutils.h	2008-08-07 20:00:58 UTC (rev 16009)
@@ -0,0 +1,98 @@
+/**
+ *
+ * $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) 2006 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): André Pinto
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BKE_BVHUTILS_H
+#define BKE_BVHUTILS_H
+
+#include "BLI_kdopbvh.h"
+
+/*
+ * This header encapsulates necessary code to buld a BVH
+ */
+
+struct DerivedMesh;
+struct MVert;
+struct MFace;
+
+/*
+ * struct that kepts basic information about a BVHTree build from a mesh
+ */
+typedef struct BVHTreeFromMesh
+{
+	struct BVHTree *tree;
+
+	/* default callbacks to bvh nearest and raycast */
+	BVHTree_NearestPointCallback nearest_callback;
+	BVHTree_RayCastCallback      raycast_callback;
+
+	/* Mesh represented on this BVHTree */
+	struct DerivedMesh *mesh; 
+
+	/* Vertex array, so that callbacks have instante access to data */
+	struct MVert *vert;
+	struct MFace *face;
+
+	/* radius for raycast */
+	float sphere_radius;
+
+} BVHTreeFromMesh;
+
+/*
+ * Builds a bvh tree where nodes are the vertexs of the given mesh.
+ * Configures BVHTreeFromMesh.
+ *
+ * The tree is build in mesh space coordinates, this means special care must be made on queries
+ * so that the coordinates and rays are first translated on the mesh local coordinates.
+ * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
+ * a BVHTree.
+ * 
+ * free_bvhtree_from_mesh should be called when the tree is no longer needed.
+ */
+void bvhtree_from_mesh_verts(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
+
+/*
+ * Builds a bvh tree where nodes are the faces of the given mesh.
+ * Configures BVHTreeFromMesh.
+ *
+ * The tree is build in mesh space coordinates, this means special care must be made on queries
+ * so that the coordinates and rays are first translated on the mesh local coordinates.
+ * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
+ * a BVHTree.
+ * 
+ * free_bvhtree_from_mesh should be called when the tree is no longer needed.
+ */
+void bvhtree_from_mesh_faces(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
+
+/*
+ * Frees data allocated by a call to bvhtree_from_mesh_*.
+ */
+void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data);
+
+#endif
+

Copied: branches/apricot/source/blender/blenkernel/intern/bvhutils.c (from rev 16008, trunk/blender/source/blender/blenkernel/intern/bvhutils.c)
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/bvhutils.c	                        (rev 0)
+++ branches/apricot/source/blender/blenkernel/intern/bvhutils.c	2008-08-07 20:00:58 UTC (rev 16009)
@@ -0,0 +1,426 @@
+/**
+ *
+ * $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) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): André Pinto.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "BKE_bvhutils.h"
+
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_utildefines.h"
+#include "BKE_deform.h"
+#include "BKE_cdderivedmesh.h"
+#include "BKE_displist.h"
+#include "BKE_global.h"
+
+#include "BLI_arithb.h"
+
+/* Math stuff for ray casting on mesh faces and for nearest surface */
+
+static float nearest_point_in_tri_surface(const float *point, const float *v0, const float *v1, const float *v2, float *nearest);
+
+#define ISECT_EPSILON 1e-6
+static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2)
+{
+	float dist;
+
+	if(RayIntersectsTriangle(ray->origin, ray->direction, v0, v1, v2, &dist, NULL))
+		return dist;
+
+	return FLT_MAX;
+}
+
+static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, const float m_dist, const float *v0, const float *v1, const float *v2)
+{
+	
+	float idist;
+	float p1[3];
+	float plane_normal[3], hit_point[3];
+
+	CalcNormFloat((float*)v0, (float*)v1, (float*)v2, plane_normal);
+
+	VECADDFAC( p1, ray->origin, ray->direction, m_dist);
+	if(SweepingSphereIntersectsTriangleUV(ray->origin, p1, radius, v0, v1, v2, &idist, &hit_point))
+	{
+		return idist * m_dist;
+	}
+
+	return FLT_MAX;
+}
+
+/*
+ * This calculates the distance from point to the plane
+ * Distance is negative if point is on the back side of plane
+ */
+static float point_plane_distance(const float *point, const float *plane_point, const float *plane_normal)
+{
+	float pp[3];
+	VECSUB(pp, point, plane_point);
+	return INPR(pp, plane_normal);
+}
+static float choose_nearest(const float v0[2], const float v1[2], const float point[2], float closest[2])
+{
+	float d[2][2], sdist[2];
+	VECSUB2D(d[0], v0, point);
+	VECSUB2D(d[1], v1, point);
+
+	sdist[0] = d[0][0]*d[0][0] + d[0][1]*d[0][1];
+	sdist[1] = d[1][0]*d[1][0] + d[1][1]*d[1][1];
+
+	if(sdist[0] < sdist[1])
+	{
+		if(closest)
+			VECCOPY2D(closest, v0);
+		return sdist[0];
+	}
+	else
+	{
+		if(closest)
+			VECCOPY2D(closest, v1);
+		return sdist[1];
+	}
+}
+/*
+ * calculates the closest point between point-tri (2D)
+ * returns that tri must be right-handed
+ * Returns square distance
+ */
+static float closest_point_in_tri2D(const float point[2], /*const*/ float tri[3][2], float closest[2])
+{
+	float edge_di[2];
+	float v_point[2];
+	float proj[2];					//point projected over edge-dir, edge-normal (witouth normalized edge)
+	const float *v0 = tri[2], *v1;
+	float edge_slen, d;				//edge squared length
+	int i;
+	const float *nearest_vertex = NULL;
+
+
+	//for each edge
+	for(i=0, v0=tri[2], v1=tri[0]; i < 3; v0=tri[i++], v1=tri[i])
+	{
+		VECSUB2D(edge_di,    v1, v0);
+		VECSUB2D(v_point, point, v0);
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list