|
Blender
V2.59
|
00001 /* 00002 * $Id: rayobject_raycounter.cpp 35233 2011-02-27 19:31:27Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2009 Blender Foundation. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): André Pinto. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00035 #include "rayobject.h" 00036 #include "raycounter.h" 00037 00038 #ifdef RE_RAYCOUNTER 00039 00040 void RE_RC_INFO(RayCounter *info) 00041 { 00042 printf("----------- Raycast counter --------\n"); 00043 printf("Rays total: %llu\n", info->raycast.test ); 00044 printf("Rays hit: %llu\n", info->raycast.hit ); 00045 printf("\n"); 00046 printf("BB tests: %llu\n", info->bb.test ); 00047 printf("BB hits: %llu\n", info->bb.hit ); 00048 printf("\n"); 00049 printf("SIMD BB tests: %llu\n", info->simd_bb.test ); 00050 printf("SIMD BB hits: %llu\n", info->simd_bb.hit ); 00051 printf("\n"); 00052 printf("Primitives tests: %llu\n", info->faces.test ); 00053 printf("Primitives hits: %llu\n", info->faces.hit ); 00054 printf("------------------------------------\n"); 00055 printf("Shadow last-hit tests per ray: %f\n", info->rayshadow_last_hit.test / ((float)info->raycast.test) ); 00056 printf("Shadow last-hit hits per ray: %f\n", info->rayshadow_last_hit.hit / ((float)info->raycast.test) ); 00057 printf("\n"); 00058 printf("Hint tests per ray: %f\n", info->raytrace_hint.test / ((float)info->raycast.test) ); 00059 printf("Hint hits per ray: %f\n", info->raytrace_hint.hit / ((float)info->raycast.test) ); 00060 printf("\n"); 00061 printf("BB tests per ray: %f\n", info->bb.test / ((float)info->raycast.test) ); 00062 printf("BB hits per ray: %f\n", info->bb.hit / ((float)info->raycast.test) ); 00063 printf("\n"); 00064 printf("SIMD tests per ray: %f\n", info->simd_bb.test / ((float)info->raycast.test) ); 00065 printf("SIMD hits per ray: %f\n", info->simd_bb.hit / ((float)info->raycast.test) ); 00066 printf("\n"); 00067 printf("Primitives tests per ray: %f\n", info->faces.test / ((float)info->raycast.test) ); 00068 printf("Primitives hits per ray: %f\n", info->faces.hit / ((float)info->raycast.test) ); 00069 printf("------------------------------------\n"); 00070 } 00071 00072 void RE_RC_MERGE(RayCounter *dest, RayCounter *tmp) 00073 { 00074 dest->faces.test += tmp->faces.test; 00075 dest->faces.hit += tmp->faces.hit; 00076 00077 dest->bb.test += tmp->bb.test; 00078 dest->bb.hit += tmp->bb.hit; 00079 00080 dest->simd_bb.test += tmp->simd_bb.test; 00081 dest->simd_bb.hit += tmp->simd_bb.hit; 00082 00083 dest->raycast.test += tmp->raycast.test; 00084 dest->raycast.hit += tmp->raycast.hit; 00085 00086 dest->rayshadow_last_hit.test += tmp->rayshadow_last_hit.test; 00087 dest->rayshadow_last_hit.hit += tmp->rayshadow_last_hit.hit; 00088 00089 dest->raytrace_hint.test += tmp->raytrace_hint.test; 00090 dest->raytrace_hint.hit += tmp->raytrace_hint.hit; 00091 } 00092 00093 #endif