Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1307 - in trunk: Image Interface
- Date: Wed, 14 Mar 2007 15:12:50 -0700 (MST)
Author: sparker
Date: Wed Mar 14 15:12:49 2007
New Revision: 1307
Modified:
trunk/Image/SimpleImage_special.cc
trunk/Interface/Fragment.h
trunk/Interface/ShadowAlgorithm.h
Log:
Add support for setting multiple pixels
Modified: trunk/Image/SimpleImage_special.cc
==============================================================================
--- trunk/Image/SimpleImage_special.cc (original)
+++ trunk/Image/SimpleImage_special.cc Wed Mar 14 15:12:49 2007
@@ -9,7 +9,18 @@
template<>
void SimpleImage<ARGB8Pixel>::set(const Fragment& fragment)
{
- if(fragment.getFlag(Fragment::ConsecutiveX|Fragment::ConstantEye)){
+ if(fragment.xPixelSize != 1 || fragment.yPixelSize != 1){
+ for(int i=fragment.begin();i<fragment.end();i++){
+ ARGB8Pixel pix;
+ convertToPixel(pix, fragment.getColor(i).convertRGB());
+
+ for(int y=0;y<fragment.yPixelSize;y++){
+ ARGB8Pixel* row =
eyeStart[fragment.getWhichEye(i)][fragment.getY(i)+y] + fragment.getX(i);
+ for(int x=0;x<fragment.xPixelSize;x++)
+ row[x] = pix;
+ }
+ }
+ } else if(fragment.getFlag(Fragment::ConsecutiveX|Fragment::ConstantEye)){
int b = fragment.begin();
ARGB8Pixel* pix =
eyeStart[fragment.getWhichEye(b)][fragment.getY(b)]+fragment.getX(b);
#if MANTA_SSE
Modified: trunk/Interface/Fragment.h
==============================================================================
--- trunk/Interface/Fragment.h (original)
+++ trunk/Interface/Fragment.h Wed Mar 14 15:12:49 2007
@@ -47,10 +47,14 @@
// Empty Constructor
Fragment(FragmentShape shape)
: shape(shape), flags(0), pixelBegin(0), pixelEnd(0)
- {}
+ {
+ xPixelSize = yPixelSize = 1;
+ }
Fragment(FragmentShape shape, int flags)
: shape(shape), flags(flags), pixelBegin(0), pixelEnd(0)
- {}
+ {
+ xPixelSize = yPixelSize = 1;
+ }
// Creates a "Scan-line" fragment.
Fragment(int xstart, int xend, int y, int eye)
@@ -207,6 +211,12 @@
color[i][which] += add[i];
}
+ void setPixelSize(int xps, int yps)
+ {
+ xPixelSize = xps;
+ yPixelSize = yps;
+ }
+
///////////////////////////////////////////////////////////////////////////
// Fragment Element Structure.
@@ -223,6 +233,8 @@
// Properties of this packet
FragmentShape shape;
int flags;
+
+ int xPixelSize, yPixelSize;
// Range of Elements that are currently being used.
int pixelBegin, pixelEnd;
Modified: trunk/Interface/ShadowAlgorithm.h
==============================================================================
--- trunk/Interface/ShadowAlgorithm.h (original)
+++ trunk/Interface/ShadowAlgorithm.h Wed Mar 14 15:12:49 2007
@@ -22,12 +22,12 @@
struct StateBuffer {
// Most shadowAlgorithms will only need to store an int or two in the
// state buffer, so we can get alignment guarantees and avoid cast
- // nastiness by supplying them here. If you use cast() below, these
- // are part of the casted object. Callers of the shadow algorithm
+ // nastiness by supplying them here. Callers of the shadow algorithm
// should not assume anything about the data in this object!
int i1, i2;
+ char data[128];
- template<class T> T& cast() {
+ template<class T> T& getData() {
// This pragma relates to the following expression being
// constant (which it is). Since sizeof(T) is evaluated after
@@ -36,18 +36,29 @@
# if defined(__sgi) && !defined(__GNUC__)
# pragma set woff 1209
- ASSERT(sizeof(T) <= sizeof(*this));
+ ASSERT(sizeof(T) <= sizeof(data));
# pragma set woff 1209
# else
- ASSERT(sizeof(T) <= sizeof(*this));
+ ASSERT(sizeof(T) <= sizeof(data));
# endif
- return *(T*)this;
+ return *(T*)data;
+ }
+
+ enum State {
+ Start, Continuing, Finished
+ };
+ State state;
+
+ StateBuffer() {
+ state = Start;
+ }
+ bool done() const {
+ return state == Finished;
}
};
- virtual bool computeShadows(const RenderContext& context, const
LightSet* lights,
- RayPacket& source, RayPacket& shadowRays,
- bool firstTime, StateBuffer& stateBuffer) =
0;
+ virtual void computeShadows(const RenderContext& context, StateBuffer&
stateBuffer,
+ const LightSet* lights, RayPacket& source,
RayPacket& shadowRays) = 0;
virtual std::string getName() const = 0;
virtual std::string getSpecs() const = 0;
- [MANTA] r1307 - in trunk: Image Interface, sparker, 03/14/2007
Archive powered by MHonArc 2.6.16.