Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r442 - in branches/itanium2: Interface Model/Groups Model/Lights Model/TexCoordMappers scenes
- Date: Tue, 26 Jul 2005 23:56:25 -0600 (MDT)
Author: abe
Date: Tue Jul 26 23:56:06 2005
New Revision: 442
Modified:
branches/itanium2/Interface/CMakeLists.txt
branches/itanium2/Model/Groups/TransparentKDTree.cc
branches/itanium2/Model/Groups/TransparentKDTree.h
branches/itanium2/Model/Groups/kdtree.cc
branches/itanium2/Model/Groups/kdtree.h
branches/itanium2/Model/Lights/HeadLight.h
branches/itanium2/Model/TexCoordMappers/CMakeLists.txt
branches/itanium2/scenes/boeing777.cc
Log:
Added KDTreeTexture which reads the color stored per face for the .v3c1
models.
This texture allows normal Manta materials (such as Lambertian) to be used
with a KDTree or
TransparentKDTree primitive.
M scenes/boeing777.cc
M Interface/CMakeLists.txt
M Model/TexCoordMappers/CMakeLists.txt
M Model/Groups/TransparentKDTree.cc
M Model/Groups/TransparentKDTree.h
M Model/Groups/kdtree.cc
M Model/Groups/kdtree.h
M Model/Lights/HeadLight.h
Modified: branches/itanium2/Interface/CMakeLists.txt
==============================================================================
--- branches/itanium2/Interface/CMakeLists.txt (original)
+++ branches/itanium2/Interface/CMakeLists.txt Tue Jul 26 23:56:06 2005
@@ -43,6 +43,7 @@
ShadowAlgorithm.cc
TexCoordMapper.h
TexCoordMapper.cc
+ Texture.h
Transaction.h
Transaction.cc
UserInterface.h
Modified: branches/itanium2/Model/Groups/TransparentKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.cc (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.cc Tue Jul 26 23:56:06
2005
@@ -73,7 +73,7 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
TransparentKDTree::TransparentKDTree( KDTree *kdtree_, Material *material_,
Real sample_alpha_ ) :
- material( material_ ),
+ PrimitiveCommon( material_ ),
rootNode( kdtree_->rootNode ),
triIndices( kdtree_->triIndices ),
tris( kdtree_->tris ),
Modified: branches/itanium2/Model/Groups/TransparentKDTree.h
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.h (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.h Tue Jul 26 23:56:06
2005
@@ -29,12 +29,15 @@
#ifndef __TRANSPARENT_KD_TREE_H__
#define __TRANSPARENT_KD_TREE_H__
-#include <Model/Groups/Group.h>
+
#include <Core/Geometry/PointVector.h>
#include <Core/Geometry/BBox.h>
#include <Interface/RayPacket.h>
+
+#include <Model/Groups/Group.h>
#include <Model/Materials/LambertianAlt.h>
+#include <Model/Primitives/PrimitiveCommon.h>
#define KDNODE_AXIS_MASK 0x0003
#define KDNODE_INTERNAL_MASK 0x0004
@@ -55,7 +58,7 @@
// Note: Uses data structures defined in normal
TransparentKDTree.
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
- class TransparentKDTree : public Primitive {
+ class TransparentKDTree : public PrimitiveCommon {
private:
BBox bbox;
@@ -65,8 +68,6 @@
VArray<Triangle> *tris;
Vectorf *normals;
- Material *material;
-
Real sample_alpha;
// This method intersects a list of triangles with
the ray.
@@ -90,9 +91,7 @@
public:
// This structure is used to record info about the
hit.
- struct ScratchPadInfo {
- Vector normal; // Normal of the intersected
face.
- Color payload; // Payload of the intersected
face.
+ struct ScratchPadInfo : public KDTree::ScratchPadInfo
{
Real alpha; // Alpha of the ray (fully
attenuated at alpha==1.0)
Real sample_t; // t value along ray of last
sample blended.
Modified: branches/itanium2/Model/Groups/kdtree.cc
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.cc (original)
+++ branches/itanium2/Model/Groups/kdtree.cc Tue Jul 26 23:56:06 2005
@@ -1042,4 +1042,18 @@
return 1;
}
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// KDTree Texture.
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void KDTreeTexture::mapValues(const RenderContext& context, RayPacket& rays,
Color results[]) const {
+
+ for (int i=0;i<rays.getSize();++i) {
+ RayPacket::Element &e = rays.get(i);
+ results[i] =
e.hitInfo.scratchpad<Kdtree::KDTree::ScratchPadInfo>().payload;
+ }
+};
+
+
Modified: branches/itanium2/Model/Groups/kdtree.h
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.h (original)
+++ branches/itanium2/Model/Groups/kdtree.h Tue Jul 26 23:56:06 2005
@@ -34,7 +34,11 @@
#include <Core/Geometry/BBox.h>
#include <Interface/RayPacket.h>
+
#include <Model/Materials/LambertianAlt.h>
+#include <Model/Primitives/PrimitiveCommon.h>
+
+#include <Interface/Texture.h>
#define KDNODE_AXIS_MASK 0x0003
#define KDNODE_INTERNAL_MASK 0x0004
@@ -239,7 +243,7 @@
// KDTREE CLASS PROPER
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
- class KDTree : public Primitive {
+ class KDTree : public PrimitiveCommon {
// Transparent KDTree will use data owned by this
kdtree.
friend class TransparentKDTree;
@@ -253,8 +257,6 @@
VArray<Triangle> *tris;
Vectorf *normals;
- Material *material;
-
// This method intersects a list of triangles with
the ray.
int intersectTriangles(const Ray* ray, unsigned int
listBegin, int listSize, float maxDist, void *userData, const RenderContext
&context) const;
@@ -263,27 +265,35 @@
public:
// Constructor.
- KDTree( Material *material_ ) : material( material_ )
{ };
+ KDTree( Material *material_ ) : PrimitiveCommon(
material_ ) { };
// This structure is used to record info about the
hit.
struct ScratchPadInfo {
- Vector normal; // Normal of the
intersected face.
+ Vector normal; // Normal of the intersected
face.
Color payload; // Payload of the intersected
face.
};
// Primitive Interface.
- void intersect(const RenderContext& context, RayPacket&
rays) const;
- void preprocess(const PreprocessContext& context) {
};
- void setTexCoordMapper(const TexCoordMapper* new_tex)
{ };
- void computeNormal(const RenderContext& context,
RayPacket& rays) const;
- void computeBounds(const PreprocessContext &context,
BBox &box_ ) const {
- box_.extendByBox( bbox ); }
- void computeBounds( BBox &box_ ) const {
box_.extendByBox( bbox ); }
+ void intersect (const RenderContext& context,
RayPacket& rays) const;
+ void computeNormal (const RenderContext& context,
RayPacket& rays) const;
+ void computeBounds (const PreprocessContext
&context, BBox &box_ ) const { box_.extendByBox( bbox ); }
+ void computeBounds ( BBox &box_ ) const {
box_.extendByBox( bbox ); }
// This function is called to load the data.
// np specifies the number of workers, for certain
loading functions.
int load( const char *fn, int np );
+ };
+
+
///////////////////////////////////////////////////////////////////////////
+
///////////////////////////////////////////////////////////////////////////
+ // KDTREE TEXTURE (For extracting color information from the
kdtree
+ // scratch pad.
+
///////////////////////////////////////////////////////////////////////////
+
///////////////////////////////////////////////////////////////////////////
+ class KDTreeTexture : public Texture<Color> {
+ public:
+ virtual void mapValues(const RenderContext& context,
RayPacket& rays, Color results[]) const;
};
}
Modified: branches/itanium2/Model/Lights/HeadLight.h
==============================================================================
--- branches/itanium2/Model/Lights/HeadLight.h (original)
+++ branches/itanium2/Model/Lights/HeadLight.h Tue Jul 26 23:56:06 2005
@@ -15,6 +15,9 @@
virtual void computeLight( Color &resultColor, Vector
&lightDirection,
const RenderContext &context,
RayPacket::Element &e ) const;
+ void setOffset( Real offset_ ) { offset = offset_; };
+ Real getOffset() { return offset; };
+
private:
Real offset;
Color color;
Modified: branches/itanium2/Model/TexCoordMappers/CMakeLists.txt
==============================================================================
--- branches/itanium2/Model/TexCoordMappers/CMakeLists.txt (original)
+++ branches/itanium2/Model/TexCoordMappers/CMakeLists.txt Tue Jul 26
23:56:06 2005
@@ -1,6 +1,9 @@
SET (Manta_TexCoordMappers_SRCS
+ TexCoordMappers/UniformMapper.h
TexCoordMappers/UniformMapper.cc
+ TexCoordMappers/SphericalMapper.h
TexCoordMappers/SphericalMapper.cc
+ TexCoordMappers/LinearMapper.h
TexCoordMappers/LinearMapper.cc
)
Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc (original)
+++ branches/itanium2/scenes/boeing777.cc Tue Jul 26 23:56:06 2005
@@ -99,6 +99,7 @@
Object *root_object = 0;
// Create a kd tree.
+ // KDTree *kdtree = new KDTree( new Lambertian( new KDTreeTexture ) );
KDTree *kdtree = new KDTree( new LambertianAlt );
double start_time = Time::currentSeconds();
- [MANTA] r442 - in branches/itanium2: Interface Model/Groups Model/Lights Model/TexCoordMappers scenes, abe, 07/26/2005
Archive powered by MHonArc 2.6.16.