Skip to content

Commit 67698fd

Browse files
committed
[core] Prune more unnecessary use of TraceThreadData.
1 parent 0f3efc8 commit 67698fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+166
-170
lines changed

source/core/lighting/lightsource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,10 @@ DBL Attenuate_Light (const LightSource *Light, const Ray &ray, DBL Distance)
658658
*
659659
******************************************************************************/
660660

661-
void LightSource::UVCoord(Vector2d& Result, const Intersection *Inter, TraceThreadData *Thread) const
661+
void LightSource::UVCoord(Vector2d& Result, const Intersection *Inter) const
662662
{
663663
if(!children.empty())
664-
children[0]->UVCoord(Result, Inter, Thread);
664+
children[0]->UVCoord(Result, Inter);
665665
}
666666

667667
}

source/core/material/normal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void Perturb_Normal(Vector3d& Layer_Normal, const TNORMAL *Tnormal, const Vector
803803
Vector2d UV_Coords;
804804

805805
/* Don't bother warping, simply get the UV vect of the intersection */
806-
Intersection->Object->UVCoord(UV_Coords, Intersection, Thread);
806+
Intersection->Object->UVCoord(UV_Coords, Intersection);
807807
TPoint[X] = UV_Coords[U];
808808
TPoint[Y] = UV_Coords[V];
809809
TPoint[Z] = 0;

source/core/material/pigment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ bool PigmentBlendMap::ComputeUVMapped(TransColour& colour, const Intersection *I
607607
const BlendMapEntry<PIGMENT*>* Cur = &(Blend_Map_Entries[0]);
608608

609609
/* Don't bother warping, simply get the UV vect of the intersection */
610-
Intersect->Object->UVCoord(UV_Coords, Intersect, Thread);
610+
Intersect->Object->UVCoord(UV_Coords, Intersect);
611611
TPoint[X] = UV_Coords[U];
612612
TPoint[Y] = UV_Coords[V];
613613
TPoint[Z] = 0;

source/core/render/trace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ void Trace::ComputeTextureColour(Intersection& isect, MathColour& colour, Colour
506506
// This causes slopes do be applied in the wrong directions.
507507

508508
// get the UV vect of the intersection
509-
isect.Object->UVCoord(uvcoords, &isect, threadData);
509+
isect.Object->UVCoord(uvcoords, &isect);
510510
// save the normal and UV coords into Intersection
511511
isect.Iuv = uvcoords;
512512

@@ -639,7 +639,7 @@ void Trace::ComputeOneTextureColour(MathColour& resultColour, ColourChannel& res
639639
// This causes slopes do be applied in the wrong directions.
640640

641641
// Don't bother warping, simply get the UV vect of the intersection
642-
isect.Object->UVCoord(uvcoords, &isect, threadData);
642+
isect.Object->UVCoord(uvcoords, &isect);
643643
tpoint = Vector3d(uvcoords[U], uvcoords[V], 0.0);
644644
cur = &(texture->Blend_Map->Blend_Map_Entries[0]);
645645
ComputeOneTextureColour(resultColour, resultTransm, cur->Vals, warps, tpoint, rawnormal, ray, weight, isect, shadowflag, photonPass);
@@ -2356,7 +2356,7 @@ void Trace::ComputeShadowColour(const LightSource &lightsource, Intersection& is
23562356
// This causes slopes do be applied in the wrong directions.
23572357

23582358
// get the UV vect of the intersection
2359-
isect.Object->UVCoord(uv_Coords, &isect, threadData);
2359+
isect.Object->UVCoord(uv_Coords, &isect);
23602360
// save the normal and UV coords into Intersection
23612361
isect.Iuv = uv_Coords;
23622362

source/core/scene/object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ double ObjectBase::GetPotential (const Vector3d& p, bool subtractThreshold, Trac
879879
*
880880
******************************************************************************/
881881

882-
void ObjectBase::UVCoord(Vector2d& Result, const Intersection *Inter, TraceThreadData *) const
882+
void ObjectBase::UVCoord(Vector2d& Result, const Intersection *Inter) const
883883
{
884884
Result[U] = Inter->IPoint[X];
885885
Result[V] = Inter->IPoint[Y];

source/core/scene/object.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ namespace pov
173173
class ObjectBase
174174
{
175175
public:
176+
176177
int Type; // TODO - make obsolete
177178
TEXTURE *Texture;
178179
TEXTURE *Interior_Texture;
@@ -232,13 +233,13 @@ class ObjectBase
232233
///
233234
/// @return True if object parameters are within reasonable limits.
234235
///
235-
virtual bool Precompute() { return true; };
236+
virtual bool Precompute() { return true; }
236237

237238
virtual bool All_Intersections(const Ray&, IStack&, TraceThreadData *) = 0; // could be "const", if it wasn't for isosurface max_gradient estimation stuff
238239
virtual double GetPotential (const Vector3d&, bool subtractThreshold, TraceThreadData *) const;
239240
virtual bool Inside(const Vector3d&, TraceThreadData *) const = 0;
240241
virtual void Normal(Vector3d&, Intersection *, TraceThreadData *) const = 0;
241-
virtual void UVCoord(Vector2d&, const Intersection *, TraceThreadData *) const;
242+
virtual void UVCoord(Vector2d&, const Intersection *) const;
242243
virtual void Translate(const Vector3d&, const TRANSFORM *) = 0;
243244
virtual void Rotate(const Vector3d&, const TRANSFORM *) = 0;
244245
virtual void Scale(const Vector3d&, const TRANSFORM *) = 0;
@@ -281,6 +282,7 @@ class ObjectBase
281282
virtual bool IsOpaque() const;
282283

283284
protected:
285+
284286
explicit ObjectBase(const ObjectBase&) { }
285287
};
286288

@@ -340,7 +342,7 @@ class LightSource final : public CompoundObject
340342
virtual bool All_Intersections(const Ray&, IStack&, TraceThreadData *) override;
341343
virtual bool Inside(const Vector3d&, TraceThreadData *) const override;
342344
virtual void Normal(Vector3d&, Intersection *, TraceThreadData *) const override;
343-
virtual void UVCoord(Vector2d&, const Intersection *, TraceThreadData *) const override;
345+
virtual void UVCoord(Vector2d&, const Intersection *) const override;
344346
virtual void Translate(const Vector3d&, const TRANSFORM *) override;
345347
virtual void Rotate(const Vector3d&, const TRANSFORM *) override;
346348
virtual void Scale(const Vector3d&, const TRANSFORM *) override;

source/core/scene/tracethreaddata.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include "core/scene/scenedata.h"
5151
#include "core/shape/blob.h"
5252
#include "core/shape/fractal.h"
53-
#include "core/shape/isosurface.h"
5453
#include "core/support/cracklecache.h"
5554

5655
// this must be the last file included
@@ -76,14 +75,6 @@ TraceThreadData::TraceThreadData(std::shared_ptr<SceneData> sd, size_t seed) :
7675
Blob_Queue = reinterpret_cast<void **>(POV_MALLOC(sizeof(void *), "Blob Queue"));
7776
Blob_Coefficients = reinterpret_cast<DBL *>(POV_MALLOC(sizeof(DBL) * Blob_Coefficient_Count, "Blob Coefficients"));
7877
Blob_Intervals = new Blob_Interval_Struct [Blob_Interval_Count];
79-
isosurfaceData = reinterpret_cast<ISO_ThreadData *>(POV_MALLOC(sizeof(ISO_ThreadData), "Isosurface Data"));
80-
isosurfaceData->pFn = nullptr;
81-
isosurfaceData->current = nullptr;
82-
isosurfaceData->cache = false;
83-
isosurfaceData->Inv3 = 1;
84-
isosurfaceData->fmax = 0.0;
85-
isosurfaceData->tl = 0.0;
86-
isosurfaceData->Vlength = 0.0;
8778

8879
BCyl_Intervals.reserve(4*sceneData->Max_Bounding_Cylinders);
8980
BCyl_RInt.reserve(2*sceneData->Max_Bounding_Cylinders);
@@ -111,7 +102,6 @@ TraceThreadData::TraceThreadData(std::shared_ptr<SceneData> sd, size_t seed) :
111102
passThruPrev = false; // was the previous object pass-through?
112103
Light_Is_Global = false; // is the current light global? (not part of a light_group?)
113104

114-
CrCache_MaxAge = 1;
115105
progress_index = 0;
116106

117107
surfacePhotonMap = new PhotonMap();
@@ -128,7 +118,6 @@ TraceThreadData::~TraceThreadData()
128118

129119
POV_FREE(Blob_Coefficients);
130120
POV_FREE(Blob_Queue);
131-
POV_FREE(isosurfaceData);
132121
Fractal::Free_Iteration_Stack(Fractal_IStack);
133122
delete surfacePhotonMap;
134123
delete mediaPhotonMap;

source/core/scene/tracethreaddata.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ namespace pov
7171

7272
using namespace pov_base;
7373

74-
struct ISO_ThreadData;
75-
7674
class PhotonMap;
7775
struct Blob_Interval_Struct;
7876

@@ -101,7 +99,6 @@ class TraceThreadData : public ThreadData
10199
Blob_Interval_Struct *Blob_Intervals;
102100
int Blob_Coefficient_Count;
103101
int Blob_Interval_Count;
104-
ISO_ThreadData *isosurfaceData; ///< @todo We may want to move this data block to the isosurface code as a local variable.
105102
std::vector<BCYL_INT> BCyl_Intervals;
106103
std::vector<BCYL_INT> BCyl_RInt;
107104
std::vector<BCYL_INT> BCyl_HInt;
@@ -182,8 +179,6 @@ class TraceThreadData : public ThreadData
182179
TraceThreadData(const TraceThreadData&) = delete;
183180
TraceThreadData& operator=(const TraceThreadData&) = delete;
184181

185-
/// current number of Tiles to expire crackle cache entries after
186-
size_t CrCache_MaxAge;
187182
/// current tile index (for crackle cache expiry)
188183
size_t progress_index;
189184
};

source/core/shape/bezier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ void BicubicPatch::Compute_BBox()
21372137
*
21382138
******************************************************************************/
21392139

2140-
void BicubicPatch::UVCoord(Vector2d& Result, const Intersection *Inter, TraceThreadData *Thread) const
2140+
void BicubicPatch::UVCoord(Vector2d& Result, const Intersection *Inter) const
21412141
{
21422142
/* Use preocmputed uv coordinates. */
21432143

source/core/shape/bezier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class BicubicPatch final : public NonsolidObject
121121
virtual bool All_Intersections(const Ray&, IStack&, TraceThreadData *) override;
122122
virtual bool Inside(const Vector3d&, TraceThreadData *) const override;
123123
virtual void Normal(Vector3d&, Intersection *, TraceThreadData *) const override;
124-
virtual void UVCoord(Vector2d&, const Intersection *, TraceThreadData *) const override;
124+
virtual void UVCoord(Vector2d&, const Intersection *) const override;
125125
virtual void Translate(const Vector3d&, const TRANSFORM *) override;
126126
virtual void Rotate(const Vector3d&, const TRANSFORM *) override;
127127
virtual void Scale(const Vector3d&, const TRANSFORM *) override;

0 commit comments

Comments
 (0)