Revision: 45780
http://brlcad.svn.sourceforge.net/brlcad/?rev=45780&view=rev
Author: kunigami
Date: 2011-08-04 02:14:30 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
removed (again) the loop in sh_osl since we are doing multi-samples before
calling this shader
Modified Paths:
--------------
brlcad/trunk/src/liboptical/sh_osl.cpp
Modified: brlcad/trunk/src/liboptical/sh_osl.cpp
===================================================================
--- brlcad/trunk/src/liboptical/sh_osl.cpp 2011-08-04 01:15:44 UTC (rev
45779)
+++ brlcad/trunk/src/liboptical/sh_osl.cpp 2011-08-04 02:14:30 UTC (rev
45780)
@@ -575,13 +575,7 @@
if(ap->a_level == 0){
default_a_hit = ap->a_hit; /* save the default hit callback (colorview
@ rt) */
default_a_miss = ap->a_miss;
- /* Get the number of samples from the environment */
- char *str_nsamples = getenv("LIBRT_OSL_SAMPLES");
- if(str_nsamples == NULL) nsamples = 10;
- else nsamples = atoi(str_nsamples);
}
- else nsamples = 1;
-
bu_semaphore_release(BU_SEM_SYSCALL);
Color3 acc_color(0.0f);
@@ -687,59 +681,57 @@
// Path-tracing (global illumination)
#else
- for(int i = 0; i < nsamples; i++){
- /* We only perform reflection if application decides to */
- info.doreflection = 0;
- info.out_ray_type = 0;
+ /* We only perform reflection if application decides to */
+ info.doreflection = 0;
+ info.out_ray_type = 0;
- Color3 weight = oslr->QueryColor(&info);
+ Color3 weight = oslr->QueryColor(&info);
- /* Fire another ray */
- if((info.out_ray_type & RAY_REFLECT) || (info.out_ray_type &
RAY_TRANSMIT)){
+ /* Fire another ray */
+ if((info.out_ray_type & RAY_REFLECT) || (info.out_ray_type &
RAY_TRANSMIT)){
- struct application new_ap;
- RT_APPLICATION_INIT(&new_ap);
+ struct application new_ap;
+ RT_APPLICATION_INIT(&new_ap);
- new_ap = *ap; /* struct copy */
- new_ap.a_onehit = 1;
- new_ap.a_hit = default_a_hit;
- new_ap.a_level = info.depth + 1;
- new_ap.a_flag = 0;
+ new_ap = *ap; /* struct copy */
+ new_ap.a_onehit = 1;
+ new_ap.a_hit = default_a_hit;
+ new_ap.a_level = info.depth + 1;
+ new_ap.a_flag = 0;
- VMOVE(new_ap.a_ray.r_dir, info.out_ray.dir);
- VMOVE(new_ap.a_ray.r_pt, info.out_ray.origin);
+ VMOVE(new_ap.a_ray.r_dir, info.out_ray.dir);
+ VMOVE(new_ap.a_ray.r_pt, info.out_ray.origin);
- /* This next ray represents refraction */
- if (info.out_ray_type & RAY_TRANSMIT){
+ /* This next ray represents refraction */
+ if (info.out_ray_type & RAY_TRANSMIT){
- /* Displace the hit point a little bit in the direction
- of the next ray */
- Vec3 tmp;
- VSCALE(tmp, info.out_ray.dir, 1e-4);
- VADD2(new_ap.a_ray.r_pt, new_ap.a_ray.r_pt, tmp);
+ /* Displace the hit point a little bit in the direction
+ of the next ray */
+ Vec3 tmp;
+ VSCALE(tmp, info.out_ray.dir, 1e-4);
+ VADD2(new_ap.a_ray.r_pt, new_ap.a_ray.r_pt, tmp);
- new_ap.a_onehit = 1;
- new_ap.a_refrac_index = 1.5;
- new_ap.a_flag = 2; /* mark as refraction */
- new_ap.a_hit = osl_refraction_hit;
- }
+ new_ap.a_onehit = 1;
+ new_ap.a_refrac_index = 1.5;
+ new_ap.a_flag = 2; /* mark as refraction */
+ new_ap.a_hit = osl_refraction_hit;
+ }
- (void)rt_shootray(&new_ap);
+ (void)rt_shootray(&new_ap);
- Color3 rec;
- VMOVE(rec, new_ap.a_color);
+ Color3 rec;
+ VMOVE(rec, new_ap.a_color);
- Color3 res = rec*weight;
- VADD2(acc_color, acc_color, res);
- }
- else {
- /* Final color */
- VADD2(acc_color, acc_color, weight);
- }
- }
+ Color3 res = rec*weight;
- VSCALE(swp->sw_color, acc_color, 1.0/nsamples);
+ VMOVE(swp->sw_color, res);
+ }
+ else {
+ /* Final color */
+ VMOVE(swp->sw_color, weight);
+ }
+ //VSCALE(swp->sw_color, acc_color, 1.0/nsamples);
#endif
return 1;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits