7 #ifndef __ray_DrawRayTrace_h__ 8 #define __ray_DrawRayTrace_h__ 87 public SurfaceBase::Impact,
93 virtual SpatialVector direction(
void)
const {
return m_direction; }
95 virtual Real distance(
void)
const {
return m_distance; }
97 virtual SpatialVector intersection(
void) {
return m_intersection; }
101 virtual Color diffuse(
void)
const 102 {
return m_diffuse; }
103 virtual void setDiffuse(
Color a_diffuse)
104 { m_diffuse=a_diffuse; }
116 void initialize(
void);
119 virtual void handle(
Record& record);
126 return m_spDrawChain->
view();
130 { m_offset=a_rTransform.translation(); }
133 { m_spDrawChain=a_spDrawI; }
135 virtual void flush(
void);
136 virtual void flushLive(
void);
137 virtual void clearInput(
void);
145 { m_spDrawChain->drawCircle(transform,scale,color); }
148 const Color& color,U32 slices)
149 { m_spDrawChain->drawCylinder(transform,scale,baseScale,
153 Real radius1,Real radius2,
154 const Color& color,U32 slices);
157 const Color& color,U32 slices);
163 using DrawNull::drawTransformed;
168 virtual void drawAxes(Real scale)
169 { m_spDrawChain->drawAxes(scale); }
171 Real radius,
const Color& color)
172 { m_spDrawChain->drawTransformedMarker(transform,radius,
176 { m_spDrawChain->drawAlignedText(location,text,color); }
179 void clearObjects(
void);
187 void ensureDrawChain(
void);
190 void drawCropBox(
const Box2i& box,
const Color& color);
192 void runTracers(
void);
193 void traceImage(U32 section,U32 sections);
194 BWORD traceRay(U32 depth,
const Vector2i& coordinate,
195 U8* element,Real contribution,BWORD from_shadow,
198 Real maxDistance,BWORD probe,
201 void logElement(U8* element);
203 U8* pixel(U32 a_x,U32 a_y)
205 const U32 x=(a_x>=m_lenx)? m_lenx-1: a_x;
206 const U32 y=(a_y>=m_leny)? m_leny-1: a_y;
207 return &m_pPixelData[(y*m_lenx+x)*3];
210 BWORD probeCheck(U32 x,U32 y)
211 {
return m_mousePress && fabs(x-m_mouse[0])<0.01f &&
212 fabs(y-m_mouse[1])<0.01f; }
214 {
return m_spDrawChain.isValid()? m_spDrawChain->view():
217 void stopThreads(
void);
235 BWORD m_autoDrawChain;
245 class TracerWorker:
public Thread::Functor
251 m_hpJobQueue(a_spJobQueue) {}
252 virtual ~TracerWorker(
void) {}
254 virtual void operate(
void);
257 { m_hpDrawRayTrace=a_spDrawRayTrace; }
virtual sp< ViewI > view(void) const
Get current view.
Definition: DrawRayTrace.h:122
virtual void setDrawChain(sp< DrawI > a_spDrawI)
Set next DrawI in a chain.
Definition: DrawRayTrace.h:132
virtual void drawCylinder(const SpatialTransform &transform, const SpatialVector *scale, Real baseScale, const Color &color, U32 slices)
Draw a transformed cylinder or cone.
Definition: DrawRayTrace.h:146
Ray-tracing implementation for DrawI.
Definition: DrawRayTrace.h:19
virtual void drawAlignedText(const SpatialVector &location, const String text, const Color &color)
Draw screen-aligned single color text.
Definition: DrawRayTrace.h:174
kernel
Definition: namespace.dox:3
virtual void setTransform(const SpatialTransform &a_rTransform)
Impose a spatial translation.
Definition: DrawRayTrace.h:129
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
virtual void draw(cp< DrawableI > cpDrawableI, const Color *color)
Draw DrawableI.
Definition: DrawNull.h:95
Special vector for color (RGBA)
Definition: Color.h:21
Dense vector - size fixed by template.
Definition: Vector.h:19
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Generalized windowing event.
Definition: WindowEvent.h:43
Safe handle for shared pointer.
Definition: Handled.h:61
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Draw nothing for DrawI, elegantly.
Definition: DrawNull.h:20
Copy-On-Write shared pointer.
Definition: Protectable.h:93
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192