[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50450] branches/soc-2011-tomato: Merging r50423 through r50449 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Thu Sep 6 11:44:32 CEST 2012


Revision: 50450
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50450
Author:   nazgul
Date:     2012-09-06 09:44:32 +0000 (Thu, 06 Sep 2012)
Log Message:
-----------
Merging r50423 through r50449 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50423
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50449

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/audaspace/intern/AUD_ReferenceHandler.cpp
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_triangle.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_types.h
    branches/soc-2011-tomato/intern/cycles/kernel/osl/CMakeLists.txt
    branches/soc-2011-tomato/intern/cycles/kernel/osl/osl_closures.cpp
    branches/soc-2011-tomato/intern/cycles/kernel/osl/osl_closures.h
    branches/soc-2011-tomato/intern/cycles/kernel/osl/osl_services.h
    branches/soc-2011-tomato/intern/cycles/kernel/osl/osl_shader.h
    branches/soc-2011-tomato/intern/cycles/render/attribute.cpp
    branches/soc-2011-tomato/intern/cycles/render/attribute.h
    branches/soc-2011-tomato/intern/cycles/render/mesh.cpp
    branches/soc-2011-tomato/intern/ghost/GHOST_IEvent.h
    branches/soc-2011-tomato/intern/ghost/GHOST_IEventConsumer.h
    branches/soc-2011-tomato/intern/ghost/GHOST_ISystem.h
    branches/soc-2011-tomato/intern/ghost/GHOST_ISystemPaths.h
    branches/soc-2011-tomato/intern/ghost/GHOST_ITimerTask.h
    branches/soc-2011-tomato/intern/ghost/GHOST_IWindow.h
    branches/soc-2011-tomato/intern/ghost/GHOST_Path-api.h
    branches/soc-2011-tomato/intern/ghost/GHOST_Rect.h
    branches/soc-2011-tomato/intern/ghost/GHOST_Types.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_Buttons.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_CallbackEventConsumer.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_CallbackEventConsumer.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManager.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManager.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerWin32.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DisplayManagerX11.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DropTargetWin32.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_DropTargetX11.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_Event.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventButton.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventCursor.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventDragnDrop.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventKey.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventManager.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventManager.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventPrinter.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventString.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventTrackpad.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_EventWheel.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_ISystem.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_ISystemPaths.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_ModifierKeys.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_ModifierKeys.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_System.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemCarbon.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemCarbon.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemCocoa.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemCocoa.mm
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemPaths.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemPathsCarbon.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemPathsCocoa.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemPathsWin32.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemPathsX11.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemWin32.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_SystemX11.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_TimerManager.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_TimerManager.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_TimerTask.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_Window.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_Window.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowCarbon.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowCarbon.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowCocoa.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowCocoa.mm
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowManager.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowManager.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowWin32.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowWin32.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowX11.cpp
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowX11.h
    branches/soc-2011-tomato/intern/ghost/test/gears/GHOST_C-Test.c
    branches/soc-2011-tomato/intern/ghost/test/gears/GHOST_Test.cpp
    branches/soc-2011-tomato/source/blender/blenfont/intern/blf_lang.c
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_customdata.h
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_object_deform.h
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_script.h
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_shrinkwrap.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/library.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mball.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/shrinkwrap.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/writeffmpeg.c
    branches/soc-2011-tomato/source/blender/blenlib/BLI_math_vector.h
    branches/soc-2011-tomato/source/blender/blenlib/BLI_path_util.h
    branches/soc-2011-tomato/source/blender/blenlib/intern/math_vector_inline.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/bmesh/bmesh.h
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_core.c
    branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_polygon.c
    branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_connect.c
    branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_subdivide.c
    branches/soc-2011-tomato/source/blender/compositor/COM_compositor.h
    branches/soc-2011-tomato/source/blender/compositor/intern/COM_Converter.cpp
    branches/soc-2011-tomato/source/blender/compositor/intern/COM_ExecutionSystemHelper.h
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_RenderLayersImageProg.h
    branches/soc-2011-tomato/source/blender/editors/animation/anim_filter.c
    branches/soc-2011-tomato/source/blender/editors/armature/reeb.c
    branches/soc-2011-tomato/source/blender/editors/armature/reeb.h
    branches/soc-2011-tomato/source/blender/editors/curve/editcurve.c
    branches/soc-2011-tomato/source/blender/editors/include/ED_mesh.h
    branches/soc-2011-tomato/source/blender/editors/include/ED_render.h
    branches/soc-2011-tomato/source/blender/editors/io/io_collada.h
    branches/soc-2011-tomato/source/blender/editors/io/io_ops.h
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_slide.c
    branches/soc-2011-tomato/source/blender/editors/screen/glutil.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_sequencer/sequencer_intern.h
    branches/soc-2011-tomato/source/blender/editors/uvedit/uvedit_intern.h
    branches/soc-2011-tomato/source/blender/ikplugin/BIK_api.h
    branches/soc-2011-tomato/source/blender/imbuf/intern/imbuf_cocoa.m
    branches/soc-2011-tomato/source/blender/makesdna/DNA_meshdata_types.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_screen_types.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_sequence_types.h
    branches/soc-2011-tomato/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_userdef.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_weightvgproximity.c
    branches/soc-2011-tomato/source/blender/render/intern/include/render_types.h
    branches/soc-2011-tomato/source/blender/render/intern/include/sunsky.h
    branches/soc-2011-tomato/source/blender/render/intern/include/volumetric.h
    branches/soc-2011-tomato/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    branches/soc-2011-tomato/source/gameengine/Expressions/PyObjectPlus.cpp
    branches/soc-2011-tomato/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
    branches/soc-2011-tomato/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
    branches/soc-2011-tomato/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
    branches/soc-2011-tomato/source/gameengine/Ketsji/KX_PythonMain.cpp

Added Paths:
-----------
    branches/soc-2011-tomato/intern/cycles/kernel/osl/bsdf_phong.cpp

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50422
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-50449

Modified: branches/soc-2011-tomato/intern/audaspace/intern/AUD_ReferenceHandler.cpp
===================================================================
--- branches/soc-2011-tomato/intern/audaspace/intern/AUD_ReferenceHandler.cpp	2012-09-06 09:23:38 UTC (rev 50449)
+++ branches/soc-2011-tomato/intern/audaspace/intern/AUD_ReferenceHandler.cpp	2012-09-06 09:44:32 UTC (rev 50450)
@@ -22,7 +22,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file audaspace/intern/AUD_Reference.cpp
+/** \file audaspace/intern/AUD_ReferenceHandler.cpp
  *  \ingroup audaspaceintern
  */
 

Modified: branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h	2012-09-06 09:23:38 UTC (rev 50449)
+++ branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h	2012-09-06 09:44:32 UTC (rev 50450)
@@ -301,7 +301,7 @@
 
 __device_inline void path_radiance_clamp(PathRadiance *L, float3 *L_sum, float clamp)
 {
-	#ifdef WITH_OSL
+	#ifdef __OSL__
 	using std::isfinite;
 	#endif
 

Modified: branches/soc-2011-tomato/intern/cycles/kernel/kernel_triangle.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/kernel_triangle.h	2012-09-06 09:23:38 UTC (rev 50449)
+++ branches/soc-2011-tomato/intern/cycles/kernel/kernel_triangle.h	2012-09-06 09:44:32 UTC (rev 50450)
@@ -15,7 +15,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
- 
+
 #include "kernel_projection.h"
 
 CCL_NAMESPACE_BEGIN
@@ -183,17 +183,39 @@
 
 /* motion */
 
+/* note: declared in kernel.h, have to add it here because kernel.h is not available */
+bool kernel_osl_use(KernelGlobals *kg);
+
 __device int triangle_find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
 {
-	/* find attribute by unique id */
-	uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;
-	uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
 
-	while(attr_map.x != id)
-		attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
-
-	/* return result */
-	return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
+#ifdef __OSL__
+	if (kernel_osl_use(kg)) {
+		/* for OSL, a hash map is used to lookup the attribute by name. */
+		OSLGlobals::AttributeMap &attr_map = kg->osl.attribute_map[sd->object];
+		ustring stdname = ustring(std::string("std::") + attribute_standard_name((AttributeStandard)id).c_str());
+		OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname);
+		if (it != attr_map.end()) {
+			const OSLGlobals::Attribute &osl_attr = it->second;
+			/* return result */
+			return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset;
+		}
+		else
+			return (int)ATTR_STD_NOT_FOUND;
+	}
+	else
+#endif
+	{
+		/* for SVM, find attribute by unique id */
+		uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;
+		uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
+		
+		while(attr_map.x != id)
+			attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
+		
+		/* return result */
+		return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
+	}
 }
 
 __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)

Modified: branches/soc-2011-tomato/intern/cycles/kernel/kernel_types.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/kernel_types.h	2012-09-06 09:23:38 UTC (rev 50449)
+++ branches/soc-2011-tomato/intern/cycles/kernel/kernel_types.h	2012-09-06 09:44:32 UTC (rev 50450)
@@ -22,6 +22,8 @@
 #include "kernel_math.h"
 #include "svm/svm_types.h"
 
+#include "util_string.h"
+
 #ifndef __KERNEL_GPU__
 #define __KERNEL_CPU__
 #endif
@@ -368,6 +370,30 @@
 	ATTR_STD_NOT_FOUND = ~0
 } AttributeStandard;
 
+__device string attribute_standard_name(AttributeStandard std)
+{
+	if(std == ATTR_STD_VERTEX_NORMAL)
+		return string("N");
+	else if(std == ATTR_STD_FACE_NORMAL)
+		return string("Ng");
+	else if(std == ATTR_STD_UV)
+		return string("uv");
+	else if(std == ATTR_STD_GENERATED)
+		return string("generated");
+	else if(std == ATTR_STD_POSITION_UNDEFORMED)
+		return string("undeformed");
+	else if(std == ATTR_STD_POSITION_UNDISPLACED)
+		return string("undisplaced");
+	else if(std == ATTR_STD_MOTION_PRE)
+		return string("motion_pre");
+	else if(std == ATTR_STD_MOTION_POST)
+		return string("motion_post");
+	else if(std == ATTR_STD_PARTICLE)
+		return string("particle");
+	
+	return string();
+}
+
 /* Closure data */
 
 #define MAX_CLOSURE 8

Modified: branches/soc-2011-tomato/intern/cycles/kernel/osl/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/osl/CMakeLists.txt	2012-09-06 09:23:38 UTC (rev 50449)
+++ branches/soc-2011-tomato/intern/cycles/kernel/osl/CMakeLists.txt	2012-09-06 09:44:32 UTC (rev 50450)
@@ -13,6 +13,7 @@
 	bsdf_ashikhmin_velvet.cpp
 	bsdf_diffuse.cpp
 	bsdf_oren_nayar.cpp
+	bsdf_phong.cpp
 	bsdf_microfacet.cpp
 	bsdf_reflection.cpp
 	bsdf_refraction.cpp

Copied: branches/soc-2011-tomato/intern/cycles/kernel/osl/bsdf_phong.cpp (from rev 50449, trunk/blender/intern/cycles/kernel/osl/bsdf_phong.cpp)
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/osl/bsdf_phong.cpp	                        (rev 0)
+++ branches/soc-2011-tomato/intern/cycles/kernel/osl/bsdf_phong.cpp	2012-09-06 09:44:32 UTC (rev 50450)
@@ -0,0 +1,277 @@
+/*
+ * Adapted from Open Shading Language with this license:
+ *
+ * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
+ * All Rights Reserved.
+ *
+ * Modifications Copyright 2012, Blender Foundation.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sony Pictures Imageworks nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <OpenImageIO/fmath.h>
+
+#include <OSL/genclosure.h>
+#include "osl_closures.h"
+#include "util_math.h"
+
+CCL_NAMESPACE_BEGIN
+
+using namespace OSL;
+
+// vanilla phong - leaks energy at grazing angles
+// see Global Illumination Compendium entry (66) 
+class PhongClosure : public BSDFClosure {
+public:
+    Vec3 m_N;
+    float m_exponent;
+    PhongClosure() : BSDFClosure(Labels::GLOSSY) { }
+
+    void setup() {};
+
+    bool mergeable (const ClosurePrimitive *other) const {
+        const PhongClosure *comp = (const PhongClosure *)other;
+        return m_N == comp->m_N && m_exponent == comp->m_exponent &&
+            BSDFClosure::mergeable(other);
+    }
+
+    size_t memsize () const { return sizeof(*this); }
+
+    const char *name () const { return "phong"; }
+
+    void print_on (std::ostream &out) const {
+        out << name() << " ((";
+        out << m_N[0] << ", " << m_N[1] << ", " << m_N[2] << "), ";
+        out << m_exponent << ")";
+    }
+
+    float albedo (const Vec3 &omega_out) const
+    {
+         return 1.0f;
+    }
+
+    Color3 eval_reflect (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
+    {
+        float cosNI = m_N.dot(omega_in);
+        float cosNO = m_N.dot(omega_out);
+        if (cosNI > 0 && cosNO > 0) {
+           // reflect the view vector
+           Vec3 R = (2 * cosNO) * m_N - omega_out;
+           float cosRI = R.dot(omega_in);
+           if (cosRI > 0) {
+               float common = 0.5f * (float) M_1_PI * powf(cosRI, m_exponent);
+               float out = cosNI * (m_exponent + 2) * common;
+               pdf = (m_exponent + 1) * common;
+               return Color3 (out, out, out);
+           }
+        }
+        return Color3 (0, 0, 0);
+    }
+
+    Color3 eval_transmit (const Vec3 &omega_out, const Vec3 &omega_in, float& pdf) const
+    {
+        return Color3 (0, 0, 0);
+    }
+
+    ustring sample (const Vec3 &Ng,
+                 const Vec3 &omega_out, const Vec3 &domega_out_dx, const Vec3 &domega_out_dy,
+                 float randu, float randv,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list