7 #ifndef __surface_SurfaceBase_h__ 8 #define __surface_SurfaceBase_h__ 35 #if FE_COUNTED_STORE_TRACKER 36 setName(
"SurfaceBase::Impact");
38 setIdentity(m_transform);
40 virtual ~Impact(
void) {}
46 const_cast<const SurfaceBase::Impact*
>(
this)
47 ->draw(a_spDrawI,a_pColor);
53 setIdentity(identity);
54 draw(identity,a_spDrawI,a_pColor);
60 const_cast<const SurfaceBase::Impact*
>(
this)
61 ->draw(a_transform,a_spDrawI,
68 draw(a_transform,a_spDrawI,
78 const_cast<const SurfaceBase::Impact*
>(
this)
79 ->draw(a_transform,a_spDrawI,
80 a_pColor,a_spDrawBuffer,
89 void setSurface(
const SurfaceI* a_pSurface)
95 { m_transform=a_transform; }
98 {
return rotateVector(m_transform,
101 {
return m_location; }
103 { m_location=a_location; }
105 virtual Color diffuse(
void)
const 106 {
return m_diffuse; }
107 virtual void setDiffuse(
Color a_diffuse)
108 { m_diffuse=a_diffuse; }
110 virtual Real radius(
void)
const 112 void setRadius(Real a_radius)
113 { m_radius=a_radius; }
118 { m_origin=a_origin; }
121 {
return m_direction; }
123 { m_direction=a_direction; }
125 virtual Real distance(
void)
const 126 {
return m_distance; }
127 void setDistance(Real a_distance)
128 { m_distance=a_distance; }
130 virtual I32 pointIndex0(
void)
const {
return -1; }
131 virtual I32 face(
void) {
return -1; }
132 virtual I32 triangleIndex(
void) {
return -1; }
133 virtual I32 primitiveIndex(
void) {
return -1; }
134 virtual I32 partitionIndex(
void) {
return -1; }
159 m_sampleMethod(e_linear),
160 m_restrictions(e_unrestricted) {}
164 virtual void protect(
void)
170 Protectable::protect();
180 virtual Real radius(
void) {
return Real(0); }
181 virtual Real radius(
void)
const {
return Real(0); }
184 {
return Color(1,1,1,1); }
186 virtual void setSampleMethod(SampleMethod a_sampleMethod)
187 { m_sampleMethod=a_sampleMethod; }
189 virtual void setNodeName(
String a_nodeName)
190 { m_nodeName=a_nodeName; }
191 virtual String nodeName(
void)
const 192 {
return m_nodeName; }
194 virtual void setRestrictions(Restrictions a_restrictions)
195 { m_restrictions=a_restrictions; }
196 virtual Restrictions restrictions(
void)
const 197 {
return m_restrictions; }
214 prepareForUVSearch();
219 {
return SpatialTransform::identity(); }
225 sample(a_triangleIndex,a_barycenter);
229 {
return sample(a_triangleIndex,a_barycenter,
233 {
return SpatialTransform::identity(); }
235 virtual sp<ImpactI> sampleImpact(I32 a_triangleIndex,
240 sampleImpact(a_triangleIndex,
243 virtual sp<ImpactI> sampleImpact(I32 a_triangleIndex,
245 {
return sampleImpact(a_triangleIndex,
248 virtual sp<ImpactI> sampleImpact(I32 a_triangleIndex,
257 prepareForUVSearch();
259 samplePoint(a_transform,a_uv);
264 prepareForUVSearch();
271 {
return transformVector(a_transform,
272 sample(a_uv).translation()); }
274 {
return sample(a_uv).translation(); }
280 prepareForUVSearch();
282 sampleNormal(a_transform,a_uv);
287 prepareForUVSearch();
294 {
return rotateVector(a_transform,
295 sample(a_uv).up()); }
297 {
return sample(a_uv).up(); }
299 virtual void prepareForSample(
void) { checkCache(); }
300 virtual void prepareForSearch(
void) {}
301 virtual void prepareForUVSearch(
void) {}
303 virtual Containment containment(
const SpatialVector& a_origin)
308 containment(a_origin);
310 virtual Containment containment(
const SpatialVector& a_origin)
const;
319 nearestPoint(a_transform,a_origin,
323 Real a_maxDistance,BWORD a_anyHit)
328 nearestPoint(a_origin,a_maxDistance,
337 nearestPoint(a_origin,a_maxDistance);
341 const Real maxDistance= -1.0;
342 return nearestPoint(a_origin,maxDistance);
347 prepareForUVSearch();
354 Real a_maxDistance)
const 357 inverseTransformVector(
358 a_transform,a_origin);
361 if(spImpact.isValid())
363 spImpact->setTransform(a_transform);
368 Real a_maxDistance,BWORD a_anyHit)
const 369 {
return nearestPoint(a_origin,a_maxDistance); }
371 Real a_maxDistance)
const 374 {
return nearestPoint(a_origin,-1.0,FALSE); }
380 nearestPoints(
const Vector2& a_uv,
381 Real a_maxDistance,U32 a_hitLimit)
384 prepareForUVSearch();
386 nearestPoints(a_uv,a_maxDistance,
390 nearestPoints(
const Vector2& a_uv,
391 Real a_maxDistance,U32 a_hitLimit)
const 397 nearestPoint(a_uv,a_maxDistance);
398 if(spImpact.isValid())
400 impactArray.resize(1);
401 impactArray[0]=spImpact;
408 Real a_maxDistance,U32 a_hitLimit)
410 return nearestPoints(a_origin,
411 a_maxDistance,a_hitLimit,
416 Real a_maxDistance,U32 a_hitLimit)
const 418 return nearestPoints(a_origin,
419 a_maxDistance,a_hitLimit,
425 Real a_maxDistance,U32 a_hitLimit,
431 nearestPoints(a_origin,a_maxDistance,
432 a_hitLimit,a_spPartition);
436 Real a_maxDistance,U32 a_hitLimit,
443 nearestPoint(a_origin,a_maxDistance);
444 if(spImpact.isValid())
446 impactArray.resize(1);
447 impactArray[0]=spImpact;
455 Real a_maxDistance,BWORD a_anyHit)
460 rayImpact(a_transform,
461 a_origin,a_direction,
462 a_maxDistance,a_anyHit);
468 Real a_maxDistance,BWORD a_anyHit)
const 471 inverseTransformVector(
472 a_transform,a_origin);
475 a_transform,a_direction);
477 invOrigin,invDirection,
478 a_maxDistance,a_anyHit);
479 if(spImpact.isValid())
481 spImpact->setTransform(a_transform);
488 Real a_maxDistance,BWORD a_anyHit)
493 rayImpact(a_origin,a_direction,
494 a_maxDistance,a_anyHit);
499 Real a_maxDistance,BWORD a_anyHit)
const 509 rayImpact(a_origin,a_direction,
510 a_maxDistance,FALSE);
515 Real a_maxDistance)
const 516 {
return rayImpact(a_origin,a_direction,
517 a_maxDistance,FALSE); }
522 Real a_maxDistance,U32 a_hitLimit)
527 rayImpacts(a_origin,a_direction,
528 a_maxDistance,a_hitLimit);
533 Real a_maxDistance,U32 a_hitLimit)
const 539 a_origin,a_direction,
540 a_maxDistance,FALSE);
541 if(spImpact.isValid())
543 impactArray.resize(1);
544 impactArray[0]=spImpact;
551 Real a_maxDistance,Real a_coneAngle,
556 Real a_maxDistance,Real a_coneAngle,
561 Real a_maxDistance,Real a_radius,
567 Real a_maxDistance,Real a_radius,
573 virtual void partitionWith(
String a_attributeName) {}
574 virtual U32 partitionCount(
void)
const {
return 0; }
575 virtual String partitionName(U32 a_index)
const {
return ""; }
576 virtual Vector4 partitionSphere(U32 a_index)
const 580 virtual I32 setPartitionFilter(
String a_filterString)
581 {
return setPartitionFilter(a_filterString,
582 PartitionI::e_matchRegex); }
583 virtual I32 setPartitionFilter(
String a_filterString,
584 PartitionI::FilterMethod a_filterMethod)
600 setIdentity(identity);
601 draw(identity,a_spDrawI,a_pColor);
609 draw(a_transform,a_spDrawI,a_pColor);
615 draw(a_transform,a_spDrawI,
627 draw(a_transform,a_spDrawI,
628 a_pColor,a_spDrawBuffer,a_spPartition);
637 virtual void bind(
Record& rRecord) {}
643 Real a_maxDistance,BWORD a_anyHit,
648 Real a_radius0,Real a_radius1,
653 virtual void cache(
void) {}
654 virtual void checkCache(
void)
664 Real a_radius,
Color a_color);
667 SampleMethod m_sampleMethod;
669 Restrictions m_restrictions;
Visualizable object using a DrawI.
Definition: DrawableI.h:20
virtual void draw(sp< DrawI > a_spDrawI, const fe::Color *a_pColor)
Draw with current settings.
Definition: SurfaceBase.h:590
virtual Color diffuse(void) const
Return the diffuse color.
Definition: SurfaceBase.h:183
virtual void setTriangulation(Triangulation a_triangulation)
Set how 4+ vertex polygons break down.
Definition: SurfaceBase.h:207
Spatial boundary.
Definition: SurfaceI.h:20
virtual void setRefinement(U32 a_refinement)
Set limitation of surface improvement, such as subdivision.
Definition: SurfaceBase.h:199
Smart pointer used with types represented by BaseType.
Definition: Instance.h:28
kernel
Definition: namespace.dox:3
Special vector for color (RGBA)
Definition: Color.h:21
virtual void bind(Instance a_instance)
associate with model data
Definition: SurfaceBase.h:175
Safe handle for shared pointer.
Definition: Handled.h:61
Automatically reference-counted string container.
Definition: String.h:128
results of a surface intersection
Definition: SurfaceI.h:60
Trivial Point Origin Surface.
Definition: SurfaceBase.h:20
Generic binding to a serializable state.
Definition: RecordableI.h:20
virtual void setSearch(String a_searchName)
Set component to use for searching.
Definition: SurfaceBase.h:205
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordSB.h:35
virtual I32 triangleCount(void)
Number of barycentric elements.
Definition: SurfaceBase.h:209
virtual void setAccuracy(SurfaceI::Accuracy a_accuracy)
Set what primitive to search down to.
Definition: SurfaceBase.h:201
virtual void setSearchable(BWORD a_searchable)
Set whether this surface may be searched.
Definition: SurfaceBase.h:203
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192