[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29491] branches/render25/source/blender/ render: Render Branch: some reshuffling of the raytracing code, should have
Brecht Van Lommel
brecht at blender.org
Wed Jun 16 20:57:26 CEST 2010
Revision: 29491
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29491
Author: blendix
Date: 2010-06-16 20:57:23 +0200 (Wed, 16 Jun 2010)
Log Message:
-----------
Render Branch: some reshuffling of the raytracing code, should have
no effect on results, but makes it easier to do some optimizations.
Seems to help a few percentages in performance, but nothing significant.
* remove RE_raytrace.h, raytracer is now only used by render engine again.
* split non-public parts rayobject.h into rayobject_internal.h, hopefully
makes it clearer how the API is used.
* added rayintersection.h to contain some of the stuff from RE_raytrace.h
* change Isect.vec/labda to Isect.dir/dist, previously vec was sometimes
normalized and sometimes not, confusing... now dir is always normalized
and dist contains the distance.
* change VECCOPY and similar to BLI_math functions.
Modified Paths:
--------------
branches/render25/source/blender/render/extern/include/RE_shader_ext.h
branches/render25/source/blender/render/intern/include/cache.h
branches/render25/source/blender/render/intern/include/raycounter.h
branches/render25/source/blender/render/intern/include/rayobject.h
branches/render25/source/blender/render/intern/raytrace/bvh.h
branches/render25/source/blender/render/intern/raytrace/rayobject.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_instance.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_octree.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_raycounter.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
branches/render25/source/blender/render/intern/raytrace/svbvh.h
branches/render25/source/blender/render/intern/source/bake.c
branches/render25/source/blender/render/intern/source/lamp.c
branches/render25/source/blender/render/intern/source/object.c
branches/render25/source/blender/render/intern/source/path.c
branches/render25/source/blender/render/intern/source/ray_trace.c
branches/render25/source/blender/render/intern/source/rayshade.c
branches/render25/source/blender/render/intern/source/rendercore.c
branches/render25/source/blender/render/intern/source/volume_precache.c
branches/render25/source/blender/render/intern/source/volumetric.c
Added Paths:
-----------
branches/render25/source/blender/render/intern/include/rayintersection.h
branches/render25/source/blender/render/intern/raytrace/rayobject_empty.cpp
branches/render25/source/blender/render/intern/raytrace/rayobject_internal.h
Removed Paths:
-------------
branches/render25/source/blender/render/extern/include/RE_raytrace.h
Deleted: branches/render25/source/blender/render/extern/include/RE_raytrace.h
===================================================================
--- branches/render25/source/blender/render/extern/include/RE_raytrace.h 2010-06-16 18:15:59 UTC (rev 29490)
+++ branches/render25/source/blender/render/extern/include/RE_raytrace.h 2010-06-16 18:57:23 UTC (rev 29491)
@@ -1,214 +0,0 @@
-/**
- * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2007 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): André Pinto.
- *
- * ***** END GPL LICENSE BLOCK *****
- * RE_raytrace.h: ray tracing api, can be used independently from the renderer.
- */
-
-#ifndef RE_RAYTRACE_H
-#define RE_RAYTRACE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// #define RE_RAYCOUNTER /* enable counters per ray, usefull for measuring raytrace structures performance */
-
-#define RE_RAY_LCTS_MAX_SIZE 256
-#define RT_USE_LAST_HIT /* last shadow hit is reused before raycasting on whole tree */
-//#define RT_USE_HINT /* last hit object is reused before raycasting on whole tree */
-
-#ifdef RE_RAYCOUNTER
-
-typedef struct RayCounter RayCounter;
-struct RayCounter
-{
-
- struct
- {
- unsigned long long test, hit;
-
- } faces, bb, simd_bb, raycast, raytrace_hint, rayshadow_last_hit;
-};
-#endif
-
-/* Internals about raycasting structures can be found on intern/raytree.h */
-typedef struct RayObject RayObject;
-typedef struct Isect Isect;
-typedef struct RayHint RayHint;
-typedef struct RayTraceHint RayTraceHint;
-
-struct DerivedMesh;
-struct Mesh;
-struct VlakRen;
-struct ObjectInstanceRen;
-
-int RE_rayobject_raycast(RayObject *r, Isect *i);
-void RE_rayobject_add (RayObject *r, RayObject *);
-void RE_rayobject_done(RayObject *r);
-void RE_rayobject_free(RayObject *r);
-
-/* Extend min/max coords so that the rayobject is inside them */
-void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max);
-
-/* initializes an hint for optiming raycast where it is know that a ray will pass by the given BB often the origin point */
-void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max);
-
-/* initializes an hint for optiming raycast where it is know that a ray will be contained inside the given cone*/
-/* void RE_rayobject_hint_cone(RayObject *r, RayHint *hint, float *); */
-
-/* RayObject constructors */
-RayObject* RE_rayobject_octree_create(int ocres, int size);
-RayObject* RE_rayobject_instance_create(RayObject *target, float transform[][4], void *ob, void *target_ob);
-RayObject* RE_rayobject_empty_create();
-
-RayObject* RE_rayobject_blibvh_create(int size); /* BLI_kdopbvh.c */
-RayObject* RE_rayobject_vbvh_create(int size); /* raytrace/rayobject_vbvh.c */
-RayObject* RE_rayobject_svbvh_create(int size); /* raytrace/rayobject_svbvh.c */
-RayObject* RE_rayobject_qbvh_create(int size); /* raytrace/rayobject_qbvh.c */
-
-
-/*
- * This ray object represents a triangle or a quad face.
- * All data needed to realize intersection is "localy" available.
- */
-typedef struct RayFace
-{
- float v1[4], v2[4], v3[4], v4[3];
- int quad;
- void *ob;
- void *face;
-
-} RayFace;
-
-#define RE_rayface_isQuad(a) ((a)->quad)
-
-RayObject* RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
-RayObject* RE_rayface_from_coords(RayFace *rayface, void *ob, void *face, float *co1, float *co2, float *co3, float *co4);
-
-
-/*
- * This ray object represents faces directly from a given VlakRen structure.
- * Thus allowing to save memory, but making code triangle intersection dependant on render structures
- */
-typedef struct VlakPrimitive
-{
- struct ObjectInstanceRen *ob;
- struct VlakRen *face;
-} VlakPrimitive;
-
-RayObject* RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
-
-
-
-/*
- * Raytrace hints
- */
-typedef struct LCTSHint LCTSHint;
-struct LCTSHint
-{
- int size;
- RayObject *stack[RE_RAY_LCTS_MAX_SIZE];
-};
-
-struct RayHint
-{
- union
- {
- LCTSHint lcts;
- } data;
-};
-
-
-/* Ray Intersection */
-struct Isect
-{
- float start[3];
- float vec[3];
- float labda;
-
- /* length of vec, configured by RE_rayobject_raycast */
- int bv_index[6];
- float idot_axis[3];
- float dist;
-
-/* float end[3]; - not used */
-
- float u, v;
-
- struct
- {
- void *ob;
- void *face;
- }
- hit, orig;
-
- RayObject *last_hit; /* last hit optimization */
-
-#ifdef RT_USE_HINT
- RayTraceHint *hint, *hit_hint;
-#endif
-
- short isect; /* which half of quad */
- short mode; /* RE_RAY_SHADOW, RE_RAY_MIRROR, RE_RAY_SHADOW_TRA */
- int lay; /* -1 default, set for layer lamps */
-
- int skip; /* RE_SKIP_CULLFACE */
-
- float col[4]; /* RGBA for shadow_tra */
-
- void *userdata;
-
- RayHint *hint;
-
-#ifdef RE_RAYCOUNTER
- RayCounter *raycounter;
-#endif
-};
-
-/* ray types */
-#define RE_RAY_SHADOW 0
-#define RE_RAY_MIRROR 1
-#define RE_RAY_SHADOW_TRA 2
-
-/* skip options */
-#define RE_SKIP_CULLFACE (1 << 0)
-
-/* if using this flag then *face should be a pointer to a VlakRen */
-#define RE_SKIP_VLR_NEIGHBOUR (1 << 1)
-#define RE_SKIP_VLR_RENDER_CHECK (1 << 2)
-#define RE_SKIP_VLR_NON_SOLID_MATERIAL (1 << 3)
-#define RE_SKIP_VLR_BAKE_CHECK (1 << 4)
-
-/* arbitrary, but can't use e.g. FLT_MAX because of precision issues */
-#define RE_RAYTRACE_MAXDIST 1e15f
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /*__RE_RAYTRACE_H__*/
Modified: branches/render25/source/blender/render/extern/include/RE_shader_ext.h
===================================================================
--- branches/render25/source/blender/render/extern/include/RE_shader_ext.h 2010-06-16 18:15:59 UTC (rev 29490)
+++ branches/render25/source/blender/render/extern/include/RE_shader_ext.h 2010-06-16 18:57:23 UTC (rev 29491)
@@ -30,7 +30,8 @@
#ifndef RE_SHADER_EXT_H
#define RE_SHADER_EXT_H
-#include "RE_raytrace.h" /* For RE_RAYCOUNTER */
+#include "../../intern/include/raycounter.h"
+
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* this include is for shading and texture exports */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
Modified: branches/render25/source/blender/render/intern/include/cache.h
===================================================================
--- branches/render25/source/blender/render/intern/include/cache.h 2010-06-16 18:15:59 UTC (rev 29490)
+++ branches/render25/source/blender/render/intern/include/cache.h 2010-06-16 18:57:23 UTC (rev 29491)
@@ -97,12 +97,5 @@
IrrCache *irr_cache_read(struct Render *re, int thread);
void irr_cache_merge(struct Render *re, IrrCache *cache);
-/* Radiosity Cache */
-
-void radio_cache_create(struct Render *re, int thread);
-void radio_cache_free(struct RenderDB *rdb, int thread);
-int radio_cache_lookup(struct Render *re, struct ShadeInput *shi, float color[3], float raylength);
-void radio_cache_add(struct Render *re, struct ShadeInput *shi, float color[3]);
-
#endif /* __RENDER_CACHE_H__ */
Modified: branches/render25/source/blender/render/intern/include/raycounter.h
===================================================================
--- branches/render25/source/blender/render/intern/include/raycounter.h 2010-06-16 18:15:59 UTC (rev 29490)
+++ branches/render25/source/blender/render/intern/include/raycounter.h 2010-06-16 18:57:23 UTC (rev 29491)
@@ -26,10 +26,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
#ifndef RE_RAYCOUNTER_H
#define RE_RAYCOUNTER_H
-#include "RE_raytrace.h"
+//#define RE_RAYCOUNTER /* enable counters per ray, usefull for measuring raytrace structures performance */
#ifdef __cplusplus
extern "C" {
@@ -37,7 +38,14 @@
#ifdef RE_RAYCOUNTER
-/* #define RE_RC_INIT(isec, shi) (isec).count = re_rc_counter+(shi).thread */
+/* ray counter functions */
+
+typedef struct RayCounter {
+ struct {
+ unsigned long long test, hit;
+ } faces, bb, simd_bb, raycast, raytrace_hint, rayshadow_last_hit;
+} RayCounter;
+
#define RE_RC_INIT(isec, shi) (isec).raycounter = &((shi).shading.raycounter)
void RE_RC_INFO (RayCounter *rc);
void RE_RC_MERGE(RayCounter *rc, RayCounter *tmp);
@@ -47,10 +55,12 @@
#else
-# define RE_RC_INIT(isec,shi)
-# define RE_RC_INFO(rc)
-# define RE_RC_MERGE(dest,src)
-# define RE_RC_COUNT(var)
+/* ray counter stubs */
+
+#define RE_RC_INIT(isec,shi)
+#define RE_RC_INFO(rc)
+#define RE_RC_MERGE(dest,src)
+#define RE_RC_COUNT(var)
#endif
Copied: branches/render25/source/blender/render/intern/include/rayintersection.h (from rev 29486, branches/render25/source/blender/render/extern/include/RE_raytrace.h)
===================================================================
--- branches/render25/source/blender/render/intern/include/rayintersection.h (rev 0)
+++ branches/render25/source/blender/render/intern/include/rayintersection.h 2010-06-16 18:57:23 UTC (rev 29491)
@@ -0,0 +1,118 @@
+/**
+ * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list