Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1916 - trunk/scenes


Chronological Thread 
  • From: arobison@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1916 - trunk/scenes
  • Date: Tue, 11 Dec 2007 18:14:24 -0700 (MST)

Author: arobison
Date: Tue Dec 11 18:14:23 2007
New Revision: 1916

Added:
   trunk/scenes/area_light.cc
Modified:
   trunk/scenes/CMakeLists.txt
Log:
Simple area light test.


Modified: trunk/scenes/CMakeLists.txt
==============================================================================
--- trunk/scenes/CMakeLists.txt (original)
+++ trunk/scenes/CMakeLists.txt Tue Dec 11 18:14:23 2007
@@ -101,3 +101,9 @@
    ADD_LIBRARY(scene_vorpal vorpal.cc)
    TARGET_LINK_LIBRARIES(scene_vorpal ${MANTA_SCENE_LINK})
 ENDIF(SCENE_VORPAL)
+
+SET(SCENE_AREA_LIGHT 0 CACHE BOOL "An area light test scene")
+IF(SCENE_AREA_LIGHT)
+   ADD_LIBRARY(scene_area_light area_light.cc)
+   TARGET_LINK_LIBRARIES(scene_area_light ${MANTA_SCENE_LINK})
+ENDIF(SCENE_AREA_LIGHT)

Added: trunk/scenes/area_light.cc
==============================================================================
--- (empty file)
+++ trunk/scenes/area_light.cc  Tue Dec 11 18:14:23 2007
@@ -0,0 +1,101 @@
+// Default scene includes.
+#include <Core/Util/Args.h>
+#include <Core/Color/ColorDB.h>
+#include <Interface/LightSet.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Backgrounds/EnvMapBackground.h>
+#include <Model/Backgrounds/TextureBackground.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Lights/AreaLight.h>
+
+#include <Model/Textures/Constant.h>
+#include <Model/Textures/CheckerTexture.h>
+#include <Model/Textures/MarbleTexture.h>
+#include <Model/Textures/ImageTexture.h>
+// Manta Materials
+#include <Model/Materials/CopyTextureMaterial.h>
+#include <Model/Materials/Dielectric.h>
+#include <Model/Materials/Flat.h>
+#include <Model/Materials/NullMaterial.h>
+#include <Model/Materials/Phong.h>
+#include <Model/Materials/MetalMaterial.h>
+#include <Model/Materials/Lambertian.h>
+
+#include <Model/Groups/Group.h>
+#include <Model/Groups/DynBVH.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/Primitives/Cube.h>
+#include <Model/TexCoordMappers/UniformMapper.h>
+#include <Core/Thread/Thread.h>
+#include <Interface/Scene.h>
+
+#include <Model/Lights/PointLight.h>
+
+#include <iostream>
+
+using namespace Manta;
+
+extern "C"
+Scene* make_scene(const ReadContext& context, const vector<string>& args)
+{
+  Scene* scene = new Scene();
+
+  bool use_dielectric = false;
+
+  for(unsigned int i = 0; i < args.size(); ++i) {
+    string arg = args[i];
+
+    if(arg == "-use_dielectric")
+      use_dielectric = true;
+
+  }
+
+  scene->setBackground(new ConstantBackground(Color::white()*.2));
+
+  Group* group = new Group();
+
+  scene->setObject(group);
+
+  LightSet* lights = new LightSet();
+
+  Color area_light_color = Color(RGB(.9,.85,.45))*6;
+  Parallelogram* area_light_geometry = new Parallelogram(new 
CopyTextureMaterial(area_light_color),
+                                                         Vector(.25,1,.25), 
Vector(.5,0,0), Vector(0,0,.5));
+  group->add(area_light_geometry);
+
+  group->add(new Parallelogram(new Lambertian(Color::white()*.8),
+                               Vector(-10, 0, -10), Vector(20, 0, 0), 
Vector(0, 0, 20)));
+
+  Material* matl;
+  if(use_dielectric) {
+    matl = new Dielectric(1.2, 1.0, Color(RGB(.5,0,0)));
+  } else {
+    matl = new Lambertian(Color(RGB(.5,0,0)));
+  }
+  group->add(new Parallelogram(matl,
+                               Vector(.25, .5, .25), Vector(0, 0,.5), 
Vector(.5,0,0)));
+
+
+
+  lights->add(new AreaLight(area_light_geometry, area_light_color));
+
+  lights->setAmbientLight(new ConstantAmbient(Color::black()));
+
+  scene->setLights(lights);
+
+  Vector eye = Vector(0, 1.25, 2);
+  Vector lookat =  Vector(.6, .32, .25); 
+
+  scene->addBookmark("default view",
+                     eye,
+                     lookat,
+                     Vector(0,1,0), 60, 45);
+
+  scene->getRenderParameters().setMaxDepth(5);
+  scene->getRenderParameters().setImportanceCutoff(0.01);
+
+  return scene;
+
+}





Archive powered by MHonArc 2.6.16.

Top of page