Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r414 - in trunk/tests: . perftest


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r414 - in trunk/tests: . perftest
  • Date: Thu, 30 Jun 2005 13:56:44 -0600 (MDT)

Author: sparker
Date: Thu Jun 30 13:56:43 2005
New Revision: 414

Added:
   trunk/tests/
   trunk/tests/CMakeLists.txt
   trunk/tests/perftest/
   trunk/tests/perftest/CMakeLists.txt
   trunk/tests/perftest/perftest1.cc
Log:
Performance test for Phong shader


Added: trunk/tests/CMakeLists.txt
==============================================================================
--- (empty file)
+++ trunk/tests/CMakeLists.txt  Thu Jun 30 13:56:43 2005
@@ -0,0 +1,3 @@
+
+SUBDIRS( perftest )
+

Added: trunk/tests/perftest/CMakeLists.txt
==============================================================================
--- (empty file)
+++ trunk/tests/perftest/CMakeLists.txt Thu Jun 30 13:56:43 2005
@@ -0,0 +1,5 @@
+
+ADD_EXECUTABLE(perftest1 perftest1.cc)
+TARGET_LINK_LIBRARIES(perftest1 Manta_Engine Manta_Model)
+
+TARGET_LINK_LIBRARIES(perftest1 ${CMAKE_THREAD_LIBS_INIT})

Added: trunk/tests/perftest/perftest1.cc
==============================================================================
--- (empty file)
+++ trunk/tests/perftest/perftest1.cc   Thu Jun 30 13:56:43 2005
@@ -0,0 +1,61 @@
+
+//
+// Phong microbenchmark
+// This program tests the performance of Phong::shade by constructing the
+// necessary data structures and calling Phong:sshade in a tight loop
+//
+
+#include <Core/Color/Color.h>
+#include <Interface/Context.h>
+#include <Interface/LightSet.h>
+#include <Interface/RayPacket.h>
+#include <Interface/Scene.h>
+#include <Engine/Shadows/HardShadows.h>
+#include <Engine/Shadows/NoShadows.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Materials/Phong.h>
+#include <Model/Primitives/Sphere.h>
+#include <string>
+using namespace Manta;
+using namespace std;
+
+int
+main()
+{
+  LightSet lights;
+  lights.add(new PointLight(Point(0,5,8), Color(RGBColor(.6,.1,.1))));
+  lights.setAmbientLight(new ConstantAmbient(Color::black()));
+
+  Color x = Color(RGBColor(1,1,1));
+  Phong p(x, Color(RGBColor(1,1,1)), 100, 0);
+  PreprocessContext ppc(0, &lights);
+  p.preprocess(ppc);
+
+  vector<string> noargs;
+  // Variant 1 - use one of the next two lines
+  NoShadows shadows(noargs);
+  //HardShadows shadows(noargs);
+
+  Sphere s(&p, Point(0, 0, 0), 1);
+  Scene scene;
+  scene.setObject(&s);
+
+  RenderContext c(0, 0, 0, 1, 0, 0, 0, 0, &shadows, 0, &scene);
+  RayPacketData data;
+  // Variant 2 - use one of the next two lines
+  RayPacket rays(data, RayPacket::MaxSize, 0, 
RayPacket::NormalizedDirections);
+  //RayPacket rays(data, RayPacket::MaxSize, 0, 0);
+  rays.resetHit();
+  rays.useLocalColors();
+  for(int i=0;i<rays.getSize();i++){
+    RayPacket::Element& e = rays.get(i);
+    e.ray = Ray(Point(0, 0, 10), Vector(0, 0, 1));
+    e.hitInfo.hit(9, &p, &s, 0);
+  }
+
+   for (int i=0;i<1000000;++i)
+     p.shade(c, rays);
+
+   return 0;
+}




  • [MANTA] r414 - in trunk/tests: . perftest, sparker, 06/30/2005

Archive powered by MHonArc 2.6.16.

Top of page