Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r385 - in branches/itanium2: Engine/Control Engine/Display Interface fox
- Date: Wed, 15 Jun 2005 19:31:31 -0600 (MDT)
Author: abe
Date: Wed Jun 15 19:31:25 2005
New Revision: 385
Added:
branches/itanium2/Engine/Display/GLXImageDisplay.cc
branches/itanium2/Engine/Display/GLXImageDisplay.h
branches/itanium2/fox/
branches/itanium2/fox/CMakeLists.txt
branches/itanium2/fox/FMantaImageFrame.cc
branches/itanium2/fox/FMantaImageFrame.h
branches/itanium2/fox/FMantaWidgets.cc
branches/itanium2/fox/FMantaWidgets.h
branches/itanium2/fox/FMantaWindow.cc
branches/itanium2/fox/FMantaWindow.h
branches/itanium2/fox/fox_manta.cc
Modified:
branches/itanium2/Engine/Control/RTRT.cc
branches/itanium2/Engine/Control/RTRT.h
branches/itanium2/Interface/RTRTInterface.h
Log:
Added proof-of-concept for embedding manta inside of a Fox Toolkit
application.
Enable BUILD_FOX in the ccmake configuration. You will need to specify the
location of a fox build.
I will put one in: /store/rhodes/abe/build-tomahawk/ here at sgi. You will
need to set the following:
FOX_PATH /store/rhodes/abe/build-tomahawk
Configure, and then the following should appear (and should be set).
FOX_INCLUDE
/store/rhodes/abe/build-tomahawk/include/fox-1.4
FOX_LIB /store/rhodes/abe/build-tomahawk/lib
FOX_STATIC FOX-1.4
A fox
A fox/fox_manta.cc
Main program file, Creates FOX application and creates manta interface
(RTRTInterface). Currently doesn't use the manta command line args.
A fox/FMantaWidgets.cc
A fox/FMantaWidgets.h
Empty for now, eventually these files will contain FXDataTarget like widgets
that use Manta's transaction model to manipulate renderer state.
A fox/FMantaWindow.cc
A fox/FMantaWindow.h
This is the main manta window. Currently it contains a file menu and a manta
menu.
A fox/FMantaImageFrame.cc
A fox/FMantaImageFrame.h
FMantaImageFrame provides a GLXContext, GLXDrawable, and X11 Display to the
new GLXImageDisplay
this enables the image display to write directly to the window inside of the
FOX application
without the need for the fox application to concern itself with updating a
framebuffer from manta.
A fox/CMakeLists.txt
Please note that I am adding .h files to the CMakeLists.txt files. This
enables cmake to place the .h files in the project files for xcode.
M Engine/Control/RTRT.cc
M Engine/Control/RTRT.h
M Interface/RTRTInterface.h
Added a method to RTRTInterface that allows a pointer to and ImageDisplay to
be passed to createChannel, rather then passing a string.
The GLXImageDisplay must be constructed with the X11 window information that
it is supposed to write into.
A Engine/Display/GLXImageDisplay.cc
A Engine/Display/GLXImageDisplay.h
GLXImageDisplay works with FMantaImageFrame (or any other X11 window) to
render GLX commands directly to the server, instead of through the
application control loop.
The fox interface is by no means in a "cooked" state. Kenny and I are going
to add some more sophisticated mouse interaction to it and further simplify
the interaction between manta and its driving application.
Modified: branches/itanium2/Engine/Control/RTRT.cc
==============================================================================
--- branches/itanium2/Engine/Control/RTRT.cc (original)
+++ branches/itanium2/Engine/Control/RTRT.cc Wed Jun 15 19:31:25 2005
@@ -52,24 +52,24 @@
namespace Manta {
RTRTInterface* createRTRT()
- {
+{
return new RTRT();
- }
+}
- bool bool_or(const bool& b1, const bool& b2) {
- return b1 || b2;
- }
- void registerKnownComponents(RTRTInterface* rtrt);
+bool bool_or(const bool& b1, const bool& b2) {
+ return b1 || b2;
+}
+void registerKnownComponents(RTRTInterface* rtrt);
}
RTRT::RTRT()
- : runningLock("RTRT running mutex"),
- callbackLock("RTRT callback r/w lock"),
- barrier1("RTRT frame barrier #1"),
- barrier2("RTRT frame barrier #2"),
- barrier3("RTRT frame barrier #3"),
- transaction_lock("RTRT transaction lock"),
- ids("RTRT id counter", 1)
+: runningLock("RTRT running mutex"),
+callbackLock("RTRT callback r/w lock"),
+barrier1("RTRT frame barrier #1"),
+barrier2("RTRT frame barrier #2"),
+barrier3("RTRT frame barrier #3"),
+transaction_lock("RTRT transaction lock"),
+ids("RTRT id counter", 1)
{
workersWanted=0;
workersRendering=0;
@@ -94,7 +94,7 @@
Channel* channel = *iter;
delete channel->display;
for(vector<Image*>::iterator iter = channel->images.begin();
- iter != channel->images.end(); iter++)
+ iter != channel->images.end(); iter++)
delete *iter;
}
delete currentImageTraverser;
@@ -107,7 +107,7 @@
{
if(newNumWorkers <= 0)
throw IllegalValue<int>("RTRT::changeNumWorkers, number of workers
should be > 0", newNumWorkers);
-
+
workersWanted=newNumWorkers;
}
@@ -117,7 +117,7 @@
}
void RTRT::addOneShotCallback(Whence /*whence*/, long frame,
- CallbackBase_2Data<int, int>* callback)
+
CallbackBase_2Data<int, int>*
callback)
{
#if NOTFINISHED
// What about adding callbacks during anim cycle?
@@ -162,33 +162,33 @@
throw InvalidState("renderLoop started while it is already running");
running=true;
runningLock.unlock();
-
+
// Preprocess
LightSet* lights = scene->getLights();
PreprocessContext context(this, lights);
lights->preprocess(context);
scene->getBackground()->preprocess(context);
scene->getObject()->preprocess(context);
-
+
if(!currentImageCreator)
throw InvalidState("Image type was not selected");
-
+
#if NOTFINISHED
check for existence of other components;
#endif
-
- if(workersWanted <= 0){
- runningLock.unlock();
- throw IllegalValue<int>("workersWanted should be positive",
workersWanted);
- }
-
+
+ if(workersWanted <= 0){
+ runningLock.unlock();
+ throw IllegalValue<int>("workersWanted should be
positive", workersWanted);
+ }
+
if(workersRendering != 0){
runningLock.unlock();
throw IllegalValue<int>("workersRendering should be zero",
workersRendering);
}
-
+
workersRendering=workersWanted;
-
+
// Start up all of the Worker threads.
workers.resize(workersWanted);
changedFlags.resize(workersWanted);
@@ -197,7 +197,7 @@
ostringstream name;
name << "RTRT Worker " << i;
Thread* t = new Thread(new Worker(this, i, false), name.str().c_str(),
- 0, Thread::NotActivated);
+
0, Thread::NotActivated);
t->setStackSize(RENDER_THREAD_STACKSIZE);
t->activate(false);
workers[i] = t;
@@ -227,30 +227,30 @@
if(proc == 0){
animFrameState.frameNumber++;
switch(timeMode){
- case RealTime:
- animFrameState.frameTime = Time::currentSeconds() * timeScale;
- break;
- case FixedRate:
- animFrameState.frameTime =
static_cast<double>(animFrameState.frameNumber) / frameRate;
- break;
- case Static:
- break;
+ case RealTime:
+ animFrameState.frameTime =
Time::currentSeconds() * timeScale;
+ break;
+ case FixedRate:
+ animFrameState.frameTime =
static_cast<double>(animFrameState.frameNumber) / frameRate;
+ break;
+ case Static:
+ break;
}
// Update the number of workers to be used for the animation and
// image display portion
workersAnimAndImage = workersRendering;
}
-
+
// Start of non-rendering portion of the loop. Make callbacks
// that could possibly change state and get everything set up to
// render the next frame
barrier1.wait(workersRendering);
-
+
// Copy over the frame state
if(proc == 0)
renderFrameState = animFrameState;
-
+
// Do callbacks
changed=false;
//callbackLock.readLock();
@@ -258,56 +258,56 @@
doSerialAnimationCallbacks(changed, proc, workersAnimAndImage);
if(proc == 0)
postTransactions(changed);
-
+
if(!firstFrame){
for(int index = 0;index < static_cast<int>(channels.size());index++){
- Channel* channel = channels[index];
- RenderContext myContext(this, index, proc, workersAnimAndImage,
- &animFrameState,
- currentLoadBalancer, currentPixelSampler,
- currentRenderer, currentShadowAlgorithm,
- channel->camera, scene);
- currentImageTraverser->setupFrame(myContext);
+ Channel* channel = channels[index];
+ RenderContext myContext(this, index, proc,
workersAnimAndImage,
+
&animFrameState,
+
currentLoadBalancer,
currentPixelSampler,
+
currentRenderer,
currentShadowAlgorithm,
+
channel->camera, scene);
+ currentImageTraverser->setupFrame(myContext);
}
}
//callbackLock.readUnlock();
-
+
// P0 resize images for next frame
if(proc == 0)
resizeImages(animFrameState.frameNumber);
-
+
// Update the number of workers to be used for the rendering of this
frame
if(proc == 0){
// Copy the number out of memory - we want to read it only once
// in case it changes
int newWorkers = workersWanted;
if(newWorkers > workersRendering){
- // We must start new threads, if the number increased. Mark
- // these threads as "latecomers", which will skip to the rendering
- // section of this loop for the first frame
- workersChanged = true;
- workers.resize(newWorkers);
- int oldworkers = workersRendering;
- workersRendering = workersWanted;
- for(int i=oldworkers;i<newWorkers;i++){
- ostringstream name;
- name << "RTRT Worker " << i;
- workers[i] = new Thread(new Worker(this, i, true),
name.str().c_str(),
- 0, Thread::NotActivated);
- workers[i]->setStackSize(RENDER_THREAD_STACKSIZE);
- workers[i]->activate(false);
- }
+ // We must start new threads, if the number
increased. Mark
+ // these threads as "latecomers", which will
skip to the rendering
+ // section of this loop for the first frame
+ workersChanged = true;
+ workers.resize(newWorkers);
+ int oldworkers = workersRendering;
+ workersRendering = workersWanted;
+ for(int i=oldworkers;i<newWorkers;i++){
+ ostringstream name;
+ name << "RTRT Worker " << i;
+ workers[i] = new Thread(new
Worker(this, i, true), name.str().c_str(),
+
0,
Thread::NotActivated);
+
workers[i]->setStackSize(RENDER_THREAD_STACKSIZE);
+ workers[i]->activate(false);
+ }
} else if(newWorkers < workersRendering) {
- workersChanged = true;
- workersRendering = workersWanted;
+ workersChanged = true;
+ workersRendering = workersWanted;
} else {
- // Don't set it to false if it is already false - avoids
- // flushing the other caches
- if(workersChanged)
- workersChanged = false;
+ // Don't set it to false if it is already
false - avoids
+ // flushing the other caches
+ if(workersChanged)
+ workersChanged = false;
}
}
-
+
// New scope to control variable lifetimes
{
// Reduce on changed flag
@@ -318,17 +318,17 @@
barrier2.wait(numProcs);
changed=false;
for(int i=0;i<numProcs;i++){
- if(changedFlags[i].changed){
- changed=true;
- break;
- }
+ if(changedFlags[i].changed){
+ changed=true;
+ break;
+ }
}
-
+
if(changed != lastChanged || firstFrame){
if(proc == 0)
doIdleModeCallbacks(changed, firstFrame, pipelineNeedsSetup,
proc, numProcs);
- barrier2.wait(numProcs);
+ barrier2.wait(numProcs);
lastChanged = changed;
}
if(firstFrame)
@@ -336,84 +336,84 @@
// P0 process deletions
if(proc == 0){
- //callbackLock.readLock();
- processDeletions();
- //callbackLock.readUnlock();
+ //callbackLock.readLock();
+ processDeletions();
+ //callbackLock.readUnlock();
}
-
+
if(pipelineNeedsSetup){
- // Negotiate the image pipeline for each channel
- if(proc == 0){
- setupPipelines(numProcs);
- resizeImages(renderFrameState.frameNumber);
- }
- for(int index = 0;index < static_cast<int>(channels.size());index++){
- Channel* channel = channels[index];
- RenderContext myContext(this, index, proc, workersAnimAndImage,
- &animFrameState,
- currentLoadBalancer, currentPixelSampler,
- currentRenderer, currentShadowAlgorithm,
- channel->camera, scene);
- currentImageTraverser->setupFrame(myContext);
- }
- barrier3.wait(numProcs);
- pipelineNeedsSetup = false;
+ // Negotiate the image pipeline for each
channel
+ if(proc == 0){
+ setupPipelines(numProcs);
+
resizeImages(renderFrameState.frameNumber);
+ }
+ for(int index = 0;index <
static_cast<int>(channels.size());index++){
+ Channel* channel = channels[index];
+ RenderContext myContext(this, index,
proc, workersAnimAndImage,
+
&animFrameState,
+
currentLoadBalancer, currentPixelSampler,
+
currentRenderer,
currentShadowAlgorithm,
+
channel->camera,
scene);
+
currentImageTraverser->setupFrame(myContext);
+ }
+ barrier3.wait(numProcs);
+ pipelineNeedsSetup = false;
}
-
+
// Image display, if image is valid
for(ChannelListType::iterator iter = channels.begin();
- iter != channels.end(); iter++){
- Channel* channel = *iter;
- long displayFrame =
(renderFrameState.frameNumber-1)%channel->pipelineDepth;
- Image* image = channel->images[displayFrame];
- if(image && image->isValid()){
- DisplayContext myContext(proc, workersAnimAndImage);
- channel->display->displayImage(myContext, image);
- }
+ iter != channels.end(); iter++){
+ Channel* channel = *iter;
+ long displayFrame =
(renderFrameState.frameNumber-1)%channel->pipelineDepth;
+ Image* image = channel->images[displayFrame];
+ if(image && image->isValid()){
+ DisplayContext myContext(proc,
workersAnimAndImage);
+
channel->display->displayImage(myContext, image);
+ }
}
-
+
// Possibly change # of workers
if(proc == 0 && workersRendering < numProcs){
- for(int i = workersRendering; i<numProcs; i++){
- // Clean up after worker. Don't attempt to join with self
- if(i != 0)
- workers[i]->join();
- }
- workers.resize(workersRendering == 0?1:workersRendering);
+ for(int i = workersRendering; i<numProcs;
i++){
+ // Clean up after worker. Don't
attempt to join with self
+ if(i != 0)
+ workers[i]->join();
+ }
+ workers.resize(workersRendering ==
0?1:workersRendering);
}
if(proc >= workersRendering)
- break;
+ break;
}
- skipToRendering:
- // Pre-render callbacks
- //callbackLock.readLock();
- doParallelPreRenderCallbacks(proc, workersRendering);
+skipToRendering:
+ // Pre-render callbacks
+ //callbackLock.readLock();
+ doParallelPreRenderCallbacks(proc, workersRendering);
doSerialPreRenderCallbacks(proc, workersRendering);
//callbackLock.readUnlock();
-
+
if(workersChanged){
barrier3.wait(workersRendering);
if(proc == 0)
- changedFlags.resize(workersRendering);
+ changedFlags.resize(workersRendering);
}
-
+
#if NOTFINISHED
//if(!idle){
#endif
{
for(int index = 0;index < static_cast<int>(channels.size());index++){
- Channel* channel = channels[index];
- long renderFrame =
renderFrameState.frameNumber%channel->pipelineDepth;
- Image* image = channel->images[renderFrame];
- RenderContext myContext(this, index, proc, workersRendering,
&renderFrameState,
- currentLoadBalancer, currentPixelSampler,
- currentRenderer, currentShadowAlgorithm,
- channel->camera, scene);
- currentImageTraverser->renderImage(myContext, image);
+ Channel* channel = channels[index];
+ long renderFrame =
renderFrameState.frameNumber%channel->pipelineDepth;
+ Image* image = channel->images[renderFrame];
+ RenderContext myContext(this, index, proc,
workersRendering, &renderFrameState,
+
currentLoadBalancer,
currentPixelSampler,
+
currentRenderer,
currentShadowAlgorithm,
+
channel->camera, scene);
+ currentImageTraverser->renderImage(myContext,
image);
}
}
#if NOTFINISHED
- how to set rendering complete flag?;
+ how to set rendering complete flag?;
} else {
//callbackLock.readLock();
idle callbacks;
@@ -460,19 +460,19 @@
transaction_lock.lock();
changed = true;
for(TransactionListType::iterator iter = transactions.begin();
- iter != transactions.end(); iter++){
+ iter != transactions.end(); iter++){
TransactionBase* transaction = *iter;
if(verbose_transactions){
- cerr << "Apply transaction: " << transaction->getName() << " : ";
- transaction->printValue(cerr);
- cerr << " : ";
- transaction->printOp(cerr);
- cerr << " : ";
+ cerr << "Apply transaction: " <<
transaction->getName() << " : ";
+ transaction->printValue(cerr);
+ cerr << " : ";
+ transaction->printOp(cerr);
+ cerr << " : ";
}
transaction->apply();
if(verbose_transactions){
- transaction->printValue(cerr);
- cerr << '\n';
+ transaction->printValue(cerr);
+ cerr << '\n';
}
delete transaction;
}
@@ -535,25 +535,43 @@
{
string name;
vector<string> args;
+
+ // Parse the arg string.
parseSpec(spec, name, args);
+
+ // Search for an image display with the name.
ImageDisplayMapType::iterator iter = imageDisplays.find(name);
if(iter == imageDisplays.end())
return 0;
+
+ // Create the channel with the image display.
+ return createChannel( (*iter->second)(args), camera, stereo, xres,
yres );
+}
+
+int RTRT::createChannel(ImageDisplay *image_display, Camera* camera, bool
stereo, int xres, int yres)
+{
+
+ // Create the channel.
Channel* channel = new Channel;
- channel->id = ids++;
- channel->display = (*iter->second)(args);
- channel->stereo = stereo;
- channel->xres = xres;
- channel->yres = yres;
- channel->active = true;
- channel->imageCreator = 0;
+ channel->id = ids++;
+ channel->display = image_display;
+ channel->stereo = stereo;
+ channel->xres = xres;
+ channel->yres = yres;
+ channel->active = true;
+ channel->imageCreator = 0;
channel->pipelineDepth = 2;
channel->images.resize(channel->pipelineDepth);
channel->camera = camera;
+
+ // Setup images for pipeline.
for(int i=0;i<channel->pipelineDepth;i++)
channel->images[i] = 0;
- pipelineNeedsSetup = true;
- channels.push_back(channel);
+
+ pipelineNeedsSetup = true;
+
+ // Add the channel to the renderer.
+ channels.push_back(channel);
return channel->id;
}
@@ -609,15 +627,15 @@
Channel* channel = channels[index];
SetupContext context(this, index, numChannels, 0, numProcs,
channel->stereo, channel->xres, channel->yres,
- currentLoadBalancer, currentPixelSampler,
+
currentLoadBalancer, currentPixelSampler,
currentRenderer);
int iteration = 100;
do {
context.setChanged(false);
context.clearMasterWindow();
for(vector<SetupCallback*>::iterator iter = setupCallbacks.begin();
- iter != setupCallbacks.end(); iter++)
- (*iter)->setupDisplayChannel(context);
+ iter != setupCallbacks.end(); iter++)
+ (*iter)->setupDisplayChannel(context);
channel->display->setupDisplayChannel(context);
currentImageTraverser->setupDisplayChannel(context);
} while(context.isChanged() && --iteration > 0);
@@ -628,7 +646,7 @@
throw IllegalValue<int>("Resolution should be positive",
channel->xres);
if(channel->yres <= 0)
throw IllegalValue<int>("Resolution should be positive",
channel->yres);
-
+
if(context.getMinDepth() > context.getMaxDepth())
throw InternalError("Pipeline depth negotiation failed");
int depth = context.getMinDepth();
@@ -644,7 +662,7 @@
channel->images.resize(depth);
}
}
-
+
void RTRT::resizeImages(long frame)
{
for(ChannelListType::iterator iter = channels.begin();
@@ -659,13 +677,13 @@
if(!channel->images[which] || channel->stereo != stereo
|| channel->xres != xres || channel->yres != yres){
if(channel->images[which])
- delete channel->images[which];
+ delete channel->images[which];
ImageCreator creator = channel->imageCreator;
if(!creator)
- creator = currentImageCreator;
+ creator = currentImageCreator;
channel->images[which] = (creator)(currentImageCreatorArgs,
- channel->stereo,
- channel->xres, channel->yres);
+
channel->stereo,
+
channel->xres, channel->yres);
} else {
if (channel->pipelineDepth > 1)
channel->images[which]->setValid(false);
@@ -920,7 +938,7 @@
string name;
vector<string> args;
parseSpec(spec, name, args);
-
+
// Pull off the suffix...
string::size_type dot = name.rfind('.');
string suffix;
@@ -930,7 +948,7 @@
suffix = name.substr(dot+1);
}
Scene* newScene = 0;
-
+
std::cout << "Scene suffix: " << suffix << std::endl;
if((suffix == "mo") || (suffix == "so") || (suffix == "dylib")) {
@@ -945,7 +963,7 @@
std::cout << "Appending .mo to scene" << std::endl;
newScene = readMOScene(name+".mo", args, false);
-
+
if(!newScene){
readMOScene(name+".mo", args, true);
}
@@ -993,7 +1011,7 @@
}
Scene* RTRT::readMOScene(const string& name, const vector<string>& args,
- bool printErrors)
+
bool printErrors)
{
vector<string> dirs = split_string(scenePath, ':');
for(vector<string>::iterator dir = dirs.begin(); dir != dirs.end(); dir++){
@@ -1001,22 +1019,22 @@
struct stat statbuf;
if(stat(fullname.c_str(), &statbuf) != 0){
if(printErrors){
- cerr << "Error reading " << fullname << ": " << strerror(errno) <<
'\n';
+ cerr << "Error reading " << fullname << ": "
<< strerror(errno) << '\n';
}
continue;
}
void* handle=dlopen(fullname.c_str(), RTLD_NOW);
if(!handle){
if(printErrors){
- cerr << "Error opening scene: " << fullname << '\n';
- cerr << dlerror() << '\n';
+ cerr << "Error opening scene: " << fullname
<< '\n';
+ cerr << dlerror() << '\n';
}
continue;
}
void* scene_fn=dlsym(handle, "make_scene");
if(!scene_fn){
if(printErrors){
- cerr << "Scene file found, but make_scene() function not found\n";
+ cerr << "Scene file found, but make_scene()
function not found\n";
}
// If we get here, we fail so that we don't keep searching the path
// for another scene
@@ -1029,7 +1047,7 @@
Scene* scene=(*make_scene)(context, args);
if(!scene){
if(printErrors)
- cerr << "scene " << name << " did not produce a scene\n";
+ cerr << "scene " << name << " did not produce
a scene\n";
return 0;
}
return scene;
Modified: branches/itanium2/Engine/Control/RTRT.h
==============================================================================
--- branches/itanium2/Engine/Control/RTRT.h (original)
+++ branches/itanium2/Engine/Control/RTRT.h Wed Jun 15 19:31:25 2005
@@ -35,6 +35,8 @@
// Image Modes (opengl, file, mpeg, etc.)
virtual int createChannel(const string& modespec, Camera* camera,
bool stereo, int xres, int yres);
+ virtual int createChannel(ImageDisplay *image_display,
Camera* camera,
+
bool stereo, int xres, int yres);
virtual void registerComponent(const string& name, ImageDisplayCreator
display);
virtual listType listImageDisplays() const;
virtual Camera* getCamera(int channel) const;
@@ -190,33 +192,44 @@
// Component databases and current instances
typedef map<string, ImageDisplayCreator> ImageDisplayMapType;
ImageDisplayMapType imageDisplays;
+
typedef map<string, ImageCreator> ImageCreatorMapType;
ImageCreatorMapType imageCreators;
- vector<string> currentImageCreatorArgs;
+
+ vector<string> currentImageCreatorArgs;
ImageCreator currentImageCreator;
typedef map<string, ImageTraverserCreator> ImageTraverserMapType;
- ImageTraverserMapType imageTraversers;
+
+ ImageTraverserMapType imageTraversers;
ImageTraverser* currentImageTraverser;
- typedef map<string, LoadBalancerCreator> LoadBalancerMapType;
+
+ typedef map<string, LoadBalancerCreator> LoadBalancerMapType;
LoadBalancerMapType loadBalancers;
LoadBalancer* currentLoadBalancer;
- typedef map<string, PixelSamplerCreator> PixelSamplerMapType;
+
+ typedef map<string, PixelSamplerCreator> PixelSamplerMapType;
PixelSamplerMapType pixelSamplers;
PixelSampler* currentPixelSampler;
- typedef map<string, RendererCreator> RendererMapType;
+
+ typedef map<string, RendererCreator> RendererMapType;
RendererMapType renderers;
Renderer* currentRenderer;
- typedef map<string, ShadowAlgorithmCreator> ShadowAlgorithmMapType;
+
+ typedef map<string, ShadowAlgorithmCreator>
ShadowAlgorithmMapType;
ShadowAlgorithmMapType shadowAlgorithms;
ShadowAlgorithm* currentShadowAlgorithm;
- typedef map<string, IdleModeCreator> IdleModeMapType;
+
+ typedef map<string, IdleModeCreator> IdleModeMapType;
IdleModeMapType idleModes;
vector<IdleMode*> currentIdleModes;
- typedef map<string, CameraCreator> CameraMapType;
+
+ typedef map<string, CameraCreator> CameraMapType;
CameraMapType cameras;
- typedef map<string, UserInterfaceCreator> UserInterfaceMapType;
+
+ typedef map<string, UserInterfaceCreator>
UserInterfaceMapType;
UserInterfaceMapType userInterfaces;
- typedef map<string, GroupCreator> GroupMapType;
+
+ typedef map<string, GroupCreator> GroupMapType;
GroupMapType groups;
// The pipeline
Added: branches/itanium2/Engine/Display/GLXImageDisplay.cc
==============================================================================
--- (empty file)
+++ branches/itanium2/Engine/Display/GLXImageDisplay.cc Wed Jun 15 19:31:25
2005
@@ -0,0 +1,125 @@
+
+#include <GL/glu.h>
+#include <X11/Xutil.h>
+
+#include <Engine/Display/GLXImageDisplay.h>
+#include <Image/SimpleImage.h>
+#include <Image/Pixel.h>
+#include <Interface/Image.h>
+#include <Interface/Context.h>
+
+#include <iostream>
+
+using namespace Manta;
+
+// Note that the GLXImage display must be passed a GLX context by the
+// application it is embedded inside of.
+GLXImageDisplay::GLXImageDisplay( GLXContext glx_context_, GLXDrawable
glx_drawable_, Display *x_display_ )
+ : glx_context( glx_context_ ), glx_drawable( glx_drawable_ ),
x_display( x_display_ )
+{
+}
+
+GLXImageDisplay::~GLXImageDisplay() {
+}
+
+// Manta ImageDisplay interface.
+void GLXImageDisplay::setupDisplayChannel( SetupContext &context ) {
+ // The setup for the window should be done in the driving application.
+
+ // Call make current to associate with this thread
+ // NOTE THIS MUST BE CALLED EACH TIME THE DISPLAY THREAD CHANGES!!
+ glXMakeCurrent( x_display, glx_drawable, glx_context );
+}
+
+void GLXImageDisplay::displayImage( const DisplayContext &context, const
Image* image ) {
+
+ // Check to see if this processor should display the image.
+ if (context.proc == context.numProcs-1) {
+
+ // Determine the image resolution.
+ int xres, yres;
+ bool stereo;
+
+ image->getResolution( stereo, xres, yres );
+
+ // NOTE THIS MUST BE CALLED EACH TIME THE DISPLAY THREAD
CHANGES!!
+ // (which is why it's here, until I figure out how to insure
that).
+ glXMakeCurrent( x_display, glx_drawable, glx_context );
+
+ // This code is from OpenGLImageDisplay.
+ glViewport(0, 0, xres, yres);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, xres, 0, yres);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.375, 0.375, 0.0);
+
+ if(typeid(*image) == typeid(SimpleImage<RGBA8Pixel>)){
+ const SimpleImage<RGBA8Pixel>* si =
dynamic_cast<const SimpleImage<RGBA8Pixel>*>(image);
+ if(stereo){
+ glDrawBuffer(GL_BACK_LEFT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA,
GL_UNSIGNED_BYTE, si->getRaw(0));
+ glDrawBuffer(GL_BACK_RIGHT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA,
GL_UNSIGNED_BYTE, si->getRaw(1));
+ } else {
+ glDrawBuffer(GL_BACK);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA,
GL_UNSIGNED_BYTE, si->getRaw(0));
+ }
+ } else if(typeid(*image) == typeid(SimpleImage<RGB8Pixel>)){
+ const SimpleImage<RGB8Pixel>* si = dynamic_cast<const
SimpleImage<RGB8Pixel>*>(image);
+ if(stereo){
+ glDrawBuffer(GL_BACK_LEFT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB,
GL_UNSIGNED_BYTE, si->getRaw(0));
+ glDrawBuffer(GL_BACK_RIGHT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB,
GL_UNSIGNED_BYTE, si->getRaw(1));
+ } else {
+ glDrawBuffer(GL_BACK);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB,
GL_UNSIGNED_BYTE, si->getRaw(0));
+ }
+ } else if(typeid(*image) ==
typeid(SimpleImage<RGBAfloatPixel>)){
+ const SimpleImage<RGBAfloatPixel>* si =
dynamic_cast<const SimpleImage<RGBAfloatPixel>*>(image);
+ if(stereo){
+ glDrawBuffer(GL_BACK_LEFT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA, GL_FLOAT,
si->getRaw(0));
+ glDrawBuffer(GL_BACK_RIGHT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA, GL_FLOAT,
si->getRaw(1));
+ } else {
+ glDrawBuffer(GL_BACK);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGBA , GL_FLOAT,
si->getRaw(0));
+ }
+ } else if(typeid(*image) ==
typeid(SimpleImage<RGBfloatPixel>)){
+ const SimpleImage<RGBfloatPixel>* si =
dynamic_cast<const SimpleImage<RGBfloatPixel>*>(image);
+ if(stereo){
+ glDrawBuffer(GL_BACK_LEFT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB, GL_FLOAT,
si->getRaw(0));
+ glDrawBuffer(GL_BACK_RIGHT);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB, GL_FLOAT,
si->getRaw(1));
+ } else {
+ glDrawBuffer(GL_BACK);
+ glRasterPos2i(0,0);
+ glDrawPixels(xres, yres, GL_RGB, GL_FLOAT,
si->getRaw(0));
+ }
+ }
+
+ // Swap buffers.
+ glXSwapBuffers( x_display, glx_drawable );
+
+ // Check for any gl error.
+ GLenum errcode = glGetError();
+ if(errcode != GL_NO_ERROR) {
+ std::cerr << "OpenGLDisplay: Error code from OpenGL:
" << gluErrorString(errcode) << std::endl;
+ }
+ }
+}
\ No newline at end of file
Added: branches/itanium2/Engine/Display/GLXImageDisplay.h
==============================================================================
--- (empty file)
+++ branches/itanium2/Engine/Display/GLXImageDisplay.h Wed Jun 15 19:31:25
2005
@@ -0,0 +1,35 @@
+#ifndef Manta_Engine_OpenGLDisplay_h
+#define Manta_Engine_OpenGLDisplay_h
+
+#include <Interface/ImageDisplay.h>
+
+#include <X11/Xlib.h>
+#include <GL/glx.h>
+
+namespace Manta {
+
+ class SetupContext;
+ class DisplayContext;
+ class Image;
+
+ class GLXImageDisplay : public ImageDisplay {
+ private:
+ // X Windows context structures passed to this class by the
driving
+ // application.
+ GLXContext glx_context;
+ GLXDrawable glx_drawable; // Or window id.
+ Display *x_display;
+
+ public:
+ // Note that the GLXImage display must be passed a GLX
context by the
+ // application it is embedded inside of.
+ GLXImageDisplay( GLXContext glx_context_, GLXDrawable
glx_drawable_, Display *x_display_ );
+ ~GLXImageDisplay();
+
+ // Manta ImageDisplay interface.
+ void setupDisplayChannel( SetupContext &context );
+ void displayImage( const DisplayContext &context, const Image* image );
+ };
+};
+
+#endif
Modified: branches/itanium2/Interface/RTRTInterface.h
==============================================================================
--- branches/itanium2/Interface/RTRTInterface.h (original)
+++ branches/itanium2/Interface/RTRTInterface.h Wed Jun 15 19:31:25 2005
@@ -38,6 +38,11 @@
typedef ImageDisplay* (*ImageDisplayCreator)(const vector<string>& args);
virtual int createChannel(const string& modespec, Camera* camera,
bool stereo, int xres, int yres) = 0;
+
+ // Create a channel given a pointer to the ImageDisplay for
the channel.
+ virtual int createChannel( ImageDisplay *image_display,
Camera *camera,
+ bool stereo, int xres, int
yres) = 0;
+
virtual void registerComponent(const string& name, ImageDisplayCreator
display) = 0;
virtual listType listImageDisplays() const = 0;
virtual Camera* getCamera(int channel) const = 0;
Added: branches/itanium2/fox/CMakeLists.txt
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/CMakeLists.txt Wed Jun 15 19:31:25 2005
@@ -0,0 +1,36 @@
+
+SET(FOX_PATH "" CACHE PATH "")
+IF(FOX_PATH)
+
+ SET(FOX_INCLUDE ${FOX_PATH}/include/fox-1.4 CACHE PATH "")
+ SET(FOX_LIB ${FOX_PATH}/lib CACHE PATH "")
+ SET(FOX_STATIC FOX-1.4 CACHE STRING "")
+
+ INCLUDE_DIRECTORIES(${FOX_INCLUDE})
+ LINK_DIRECTORIES (${FOX_LIB} )
+
+ ADD_EXECUTABLE(fox_manta fox_manta.cc
+ FMantaImageFrame.cc
+ FMantaImageFrame.h
+ FMantaWidgets.cc
+ FMantaWidgets.h
+ FMantaWindow.cc
+ FMantaWindow.h )
+
+
+ TARGET_LINK_LIBRARIES(fox_manta Manta_Engine
+ Manta_UserInterface
+ Manta_Model
+ Manta_Image
+ Manta_Interface
+ Manta_Core
+ SCIRun_Core)
+
+ TARGET_LINK_LIBRARIES(fox_manta ${FOX_STATIC}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${OPENGL_LIBRARIES}
+ ${X11_LIBRARIES}
+ -lm
+ -lXcursor
+ -lXrandr)
+ENDIF(FOX_PATH)
\ No newline at end of file
Added: branches/itanium2/fox/FMantaImageFrame.cc
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/FMantaImageFrame.cc Wed Jun 15 19:31:25 2005
@@ -0,0 +1,50 @@
+
+#include <fox/FMantaImageFrame.h>
+
+#include <fxkeys.h>
+
+#include <iostream>
+
+using namespace fox_manta;
+using namespace Manta;
+using namespace FX;
+
+// Message map.
+FXDEFMAP(FMantaImageFrame) FMantaImageFrameMap[] = {
+
//////////////////////////////////////////////////////////////////////////////
+ // Message_Type ID
Message_Handler
+ FXMAPFUNC(SEL_LEFTBUTTONRELEASE, FMantaImageFrame::ID_IMAGE,
FMantaImageFrame::onMouseChange ),
+ FXMAPFUNC(SEL_MIDDLEBUTTONRELEASE, FMantaImageFrame::ID_IMAGE,
FMantaImageFrame::onMouseChange ),
+ FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, FMantaImageFrame::ID_IMAGE,
FMantaImageFrame::onMouseChange ),
+ FXMAPFUNC(SEL_KEYPRESS, FMantaImageFrame::ID_IMAGE,
FMantaImageFrame::onKeyPress )
+};
+
+FXIMPLEMENT(FMantaImageFrame,FXGLCanvas,FMantaImageFrameMap,ARRAYNUMBER(FMantaImageFrameMap));
+
+// Constructor, creates a GLX Visual with a double buffer.
+FMantaImageFrame::FMantaImageFrame( FXComposite *p, FXApp *app, int width,
int height, RTRTInterface *manta_interface_ )
+ : FXGLCanvas( p, new FXGLVisual( app, VISUAL_DOUBLEBUFFER ), this,
ID_IMAGE, LAYOUT_FILL, 0, 0, width, height ),
+ manta_interface( manta_interface_ )
+{
+}
+
+// Default implementations of the on mouse change and key press.
+long FMantaImageFrame::onMouseChange( FXObject *sender, FXSelector sel, void
*data ) {
+
+ return 1;
+}
+
+long FMantaImageFrame::onKeyPress ( FXObject *sender, FXSelector sel, void
*data ) {
+
+ FXEvent *event = (FXEvent *)data;
+
+ // Check for a quit only by default.
+ if (event->text[0] == 'q') {
+ std::cerr << "Finish after next frame." << std::endl;
+ manta_interface->finish();
+ }
+
+ return 1;
+}
+
+
Added: branches/itanium2/fox/FMantaImageFrame.h
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/FMantaImageFrame.h Wed Jun 15 19:31:25 2005
@@ -0,0 +1,45 @@
+#ifndef fox_FMantaImageFrame__H
+#define fox_FMantaImageFrame__H
+
+#include <fx.h>
+#include <fx3d.h>
+
+#include <Interface/RTRTInterface.h>
+
+namespace fox_manta {
+
+ using namespace FX;
+ using namespace Manta;
+
+ // This class contains the GLX context and window that will be used
by a manta
+ // channel to render into.
+ class FMantaImageFrame : public FXGLCanvas {
+ FXDECLARE(FMantaImageFrame)
+ private:
+ // Pointer to the Manta interface to send commands.
+ RTRTInterface *manta_interface;
+
+ public:
+ // Message types.
+ enum {
+ ID_IMAGE = FXGLCanvas::ID_LAST, // Messages from the
gl canvas.
+ ID_LAST
+ };
+
+ // Constructors.
+ FMantaImageFrame() : manta_interface( 0 ) { };
+ FMantaImageFrame( FXComposite *p, FXApp *app, int width, int
height, RTRTInterface *manta_interface_ );
+
+ // Fox message handlers for mouse and keyboard.
+ long onMouseChange( FXObject *sender, FXSelector sel, void
*data );
+ long onKeyPress ( FXObject *sender, FXSelector sel, void *data );
+
+ // Accessors.
+ void setMantaInterface( RTRTInterface *manta_interface_ ) {
manta_interface = manta_interface_; };
+
+ RTRTInterface *getMantaInterface() { return manta_interface;
};
+ };
+
+};
+
+#endif
\ No newline at end of file
Added: branches/itanium2/fox/FMantaWidgets.cc
==============================================================================
Added: branches/itanium2/fox/FMantaWidgets.h
==============================================================================
Added: branches/itanium2/fox/FMantaWindow.cc
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/FMantaWindow.cc Wed Jun 15 19:31:25 2005
@@ -0,0 +1,46 @@
+#include <fox/FMantaWindow.h>
+#include <fox/FMantaImageFrame.h>
+
+#include <iostream>
+
+using namespace fox_manta;
+using namespace Manta;
+
+FXDEFMAP(FMantaWindow) FMantaWindowMap[] = {
+
//////////////////////////////////////////////////////////////////////////////
+ // Message_Type ID
Message_Handler
+ FXMAPFUNC(SEL_COMMAND, FMantaWindow::ID_QUIT, FMantaWindow::onQuit ),
+};
+
+FXIMPLEMENT(FMantaWindow,FXMainWindow,FMantaWindowMap,ARRAYNUMBER(FMantaWindowMap));
+
+FMantaWindow::FMantaWindow( FXApp *app, const FXString &name, int width, int
height,
+
FXIcon *ic,FXIcon *mi,FXuint opts,FXint
x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint
vs )
+ : FXMainWindow( app, name, ic, mi, opts, x, y, w, h, pl, pr, pt, pb,
hs, vs ),
+
+ manta_interface( 0 )
+{
+ // Menu Bar.
+ menu_bar = new FXMenuBar( this, LAYOUT_FILL_X );
+
+ // File Menu.
+ file_menu = new FXMenuPane( this );
+ new FXMenuCommand( file_menu, "Quit", 0, this, ID_QUIT );
+ new FXMenuTitle ( menu_bar, "File", 0, file_menu );
+
+ // Manta Menu.
+ manta_menu = new FXMenuPane( this );
+ new FXMenuTitle( menu_bar, "Manta", 0, manta_menu );
+
+ // Manta Image Frame.
+ manta_frame = new FMantaImageFrame( this, app, width, height, 0 );
+}
+
+// Quit the program.
+long FMantaWindow::onQuit( FXObject *sender, FXSelector key, void *data ) {
+
+ // Hard quit.
+ exit( 0 );
+
+ return 1;
+};
Added: branches/itanium2/fox/FMantaWindow.h
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/FMantaWindow.h Wed Jun 15 19:31:25 2005
@@ -0,0 +1,69 @@
+#ifndef fox_FMantaWindow__H
+#define fox_FMantaWindow__H
+
+#include <fx.h>
+#include <fx3d.h>
+
+#include <Interface/RTRTInterface.h>
+#include <Engine/Display/GLXImageDisplay.h>
+
+#include <fox/FMantaImageFrame.h>
+
+namespace fox_manta {
+
+ using namespace FX;
+ using namespace Manta;
+
+ // This is the main window for the Fox application.
+ // this class will have a pointer to the RTRTInterface (manta
interface)
+ // it will also be responsible for initializing manta as well as the
rest of
+ // the application.
+ class FMantaWindow : public FXMainWindow {
+ FXDECLARE(FMantaWindow)
+ private:
+
+ // Interface to the manta rendering library.
+ RTRTInterface *manta_interface;
+
+ // Other manta pipeline components which the application
"controls"
+ // (Transactions must be sent through manta in order to
manipulate
+ // these components.
+ GLXImageDisplay *manta_image_display;
+
+
+ // Fox GUI Components.
+ FXMenuBar *menu_bar;
+ FXMenuPane *file_menu;
+ FXMenuPane *manta_menu;
+
+ // Image panels for displaying output.
+ FMantaImageFrame *manta_frame;
+
+ public:
+ // Commands for the main window.
+ enum {
+ ID_QUIT = FXMainWindow::ID_LAST, // Sent when the
application must quit.
+ ID_LAST
+ };
+
+ // Constructors.
+ FMantaWindow() : manta_interface( 0 ) { };
+ FMantaWindow( FXApp *app, const FXString &name, int width =
512, int height = 512,
+ FXIcon *ic=NULL,FXIcon *mi=NULL,FXuint
opts=(DECOR_TITLE|DECOR_MINIMIZE|DECOR_MAXIMIZE|DECOR_BORDER|DECOR_SHRINKABLE|DECOR_STRETCHABLE|DECOR_MENU),FXint
x=20,FXint y=20,FXint w=512,FXint h=512,FXint pl=0,FXint pr=0,FXint
pt=0,FXint pb=0,FXint hs=0,FXint vs=0);
+
+ // Create the window.
+ void create() { FXMainWindow::create(); show(
PLACEMENT_DEFAULT ); };
+
+ // Message handlers.
+ long onQuit( FXObject *sender, FXSelector key, void *data );
+
+ // Accessors.
+ void setMantaInterface( RTRTInterface *manta_interface_ ) {
manta_interface = manta_interface_; manta_frame->setMantaInterface(
manta_interface_ ); };
+
+ RTRTInterface *getMantaInterface() { return
manta_interface; };
+ FMantaImageFrame *getMantaFrame() { return manta_frame; };
+
+ };
+};
+
+#endif
\ No newline at end of file
Added: branches/itanium2/fox/fox_manta.cc
==============================================================================
--- (empty file)
+++ branches/itanium2/fox/fox_manta.cc Wed Jun 15 19:31:25 2005
@@ -0,0 +1,122 @@
+#include <Interface/RTRTInterface.h>
+#include <Core/Color/ColorDB.h>
+#include <Core/Util/Args.h>
+#include <Interface/Callback.h>
+#include <Interface/Scene.h>
+#include <Interface/Camera.h>
+
+#include <X11/Xlib.h>
+
+#include <Engine/Display/GLXImageDisplay.h>
+
+#include <fox/FMantaWindow.h>
+
+using namespace FX;
+using namespace fox_manta;
+using namespace Manta;
+
+Scene* createDefaultScene();
+
+int main( int argc, char *argv[]) {
+
+ // Make a fox application object.
+ FXApp app( "", "Abe Stephens -- SGI" );
+ app.init( argc, argv );
+
+ // Add an FMantaWindow.
+ FMantaWindow manta_window( &app, "Fox/Manta Demo App" );
+
+ // Create the application's windows.
+ app.create();
+
+ // Construct Manta.
+ RTRTInterface *manta_interface = createRTRT();
+
+ manta_interface->setScenePath (".");
+ manta_interface->changeNumWorkers ( 1 );
+ manta_interface->selectImageType ( "rgba8" );
+ manta_interface->selectLoadBalancer ( "workqueue" );
+ manta_interface->selectImageTraverser ( "tiled" );
+ manta_interface->selectPixelSampler ( "singlesample" );
+ manta_interface->selectRenderer ( "raytracer" );
+ manta_interface->selectShadowAlgorithm( "hard" );
+
+ Camera *camera = manta_interface->createCamera( "pinhole(-eye 3 3 2
-lookat 0 0 0.3 -up 0 0 1 -fov 60)" );
+
+ // Create the manta image display.
+ FMantaImageFrame *manta_frame = manta_window.getMantaFrame();
+
+ // Create a glx image display.
+ GLXImageDisplay glx_image_display(
(GLXContext)manta_frame->getContext(),
+ (Window) manta_frame->id(),
+
(Display
*) app.getDisplay() );
+
+ // Create manta channel for the interface.
+ manta_interface->createChannel( &glx_image_display, camera, false,
512, 512 );
+
+ // Create a default scene.
+ manta_interface->setScene( createDefaultScene() );
+
+ // Set the manta interface for the application.
+ manta_window.setMantaInterface( manta_interface );
+
+ // Start up manta.
+ manta_interface->beginRendering(false);
+
+ // Start fox control loop.
+ return app.run();
+}
+
+#include <Interface/LightSet.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Textures/Constant.h>
+#include <Model/Textures/CheckerTexture.h>
+#include <Model/Materials/Phong.h>
+#include <Model/Groups/Group.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/TexCoordMappers/UniformMapper.h>
+
+Scene* createDefaultScene()
+{
+ // Create a default scene. This scene is used for benchmarks, so
+ // please do not change it. Please create a new scene instead
+ Scene* scene = new Scene();
+ scene->setBackground(new
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")*0.5));
+ Material* red=new Phong(Color(RGBColor(.6,0,0)),
+ Color(RGBColor(.6,.6,.6)), 32, 0.4);
+
+ Material* plane_matl = new Phong(new
CheckerTexture<Color>(Color(RGBColor(.6,.6,.6)),
+
Color(RGBColor(0,0,0)),
+
Vector(1,0,0),
+
Vector(0,1,0)),
+
new
Constant<Color>(Color(RGBColor(.6,.6,.6))),
+
32,
+
new
CheckerTexture<double>(0.2, 0.5,
+
Vector(1,0,0),
+
Vector(0,1,0)));
+
+
+ Group* world = new Group();
+ Primitive* floor = new Parallelogram(plane_matl, Point(-20,-20,0),
+
Vector(40,0,0), Vector(0,40,0));
+ // Setup world-space texture coordinates for the checkerboard floor
+ UniformMapper* uniformmap = new UniformMapper();
+ floor->setTexCoordMapper(uniformmap);
+ world->add(floor);
+ world->add(new Sphere(red, Point(0,0,1.2), 1.0));
+ scene->setObject(world);
+
+ LightSet* lights = new LightSet();
+ lights->add(new PointLight(Point(0,5,8), Color(RGBColor(.6,.1,.1))));
+ lights->add(new PointLight(Point(5,0,8), Color(RGBColor(.1,.6,.1))));
+ lights->add(new PointLight(Point(5,5,2), Color(RGBColor(.2,.2,.2))));
+ lights->setAmbientLight(new ConstantAmbient(Color::black()));
+ scene->setLights(lights);
+ scene->getRenderParameters().maxDepth = 5;
+ return scene;
+}
+
+
- [MANTA] r385 - in branches/itanium2: Engine/Control Engine/Display Interface fox, abe, 06/15/2005
Archive powered by MHonArc 2.6.16.