11 #ifndef __GU_PrimVolumeCache__
12 #define __GU_PrimVolumeCache__
48 : myOrg(0,0,0), myDir(0,0,0), myCd(0,0,0), myShadow(0.0),
49 myHasAttenuation(false), myIsAmbient(false), myIsInfinite(false),
50 myIsHeadlight(false), myIsEnvironment(false), myIsCone(false),
56 for(
int i = 0; i < 8; i++)
74 if(myIsCone != l.
myIsCone || (myIsCone &&
80 return (myOrg == l.
myOrg) &&
87 (!myIsEnvironment || (myEnvMap == l.
myEnvMap &&
90 && myEnvLight == l.myEnvLight));
111 void setEnvironmentLight(
GR_EnvLight* env) { myEnvLight = env; }
124 GR_EnvLight* getEnvironmentLight()
const {
return myEnvLight; }
133 float getDistance(
const UT_Vector3 &pos)
const;
138 myHasAttenuation =
true;
139 for(
int i=0; i<8; i++)
143 float getAttenuation(
const UT_Vector3F &uvw)
const;
155 float myAttenuationCoeffs[3];
183 virtual
int64 getMemoryUsage(
bool inclusive) const = 0;
189 GU_PrimVolumeCacheRamp(
UT_Ramp *ramp,
bool periodic);
190 ~GU_PrimVolumeCacheRamp();
192 void eval(
float &rval,
float val)
const;
208 const char *attribname)
const;
213 const char *attribname,
214 int collateidx)
const;
215 void selectVolumesFromAttribute(
218 const char *attribname,
219 int collateidx)
const;
220 void getRangeFromAttribute(
222 const char *attribname,
223 float &rmin,
float &rscale)
const;
224 float getFloatFromAttribute(
226 const char *attribname,
229 float getDensity(
int x,
int y,
int z)
const;
230 UT_Vector4 getDiffuse(
int x,
int y,
int z)
const;
249 float rmin,
float rinvscale);
255 float rmin,
float rinvscale);
261 float rmin,
float rinvscale);
267 float rmin,
float rinvscale);
278 bool hasEmission()
const;
323 *reduced = myVolumeReduced;
340 {
return myVolumeXform; }
344 int64 mem = inclusive ?
sizeof(*this) : 0;
346 mem += myVoxels->getMemoryUsage(
true);
347 mem += myLightList.getMemoryUsage(
true);
349 mem += myTexture->getMemoryUsage(
true);
350 mem += myIsoSurf.getMemoryUsage(
false);
358 float shadowdensity);
367 void computeAlphaVoxelsPartial(
381 bool indexToPos(
int x,
int y,
int z,
UT_Vector3 &pos)
const;
382 bool posToIndex(
UT_Vector3 pos,
int &x,
int &y,
int &z)
const;
394 bool myVolumeReduced;
407 : myMaxResW(0), myMaxResH(0), myMaxResD(0)
411 , myPreMultiply(true)
417 { myLightList = lightlist; }
419 {
return myLightList; }
422 { myMaxResW =
w; myMaxResH =
h; myMaxResD = d; }
424 { w = myMaxResW; h = myMaxResH; d = myMaxResD; }
427 { myDownscale =
scale; }
429 {
return myDownscale; }
434 {
return myMax2DRes; }
454 mutable bool myCachedFlag;
void setIsEnvironment(bool env)
const float * getConstAttenuationCoeffArray() const
GU_PrimVolumeCacheParms()
const UT_Array< GU_PrimVolumeCacheLight > & getLights() const
void setIsAmbient(bool isamb)
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
const UT_Vector3 & getOrg() const
SIM_API const UT_StringHolder angle
#define SYS_DEPRECATED_PUSH_DISABLE()
void setCd(const UT_Vector3 &cd)
const GEO_Primitive * myEmissionField
#define SYS_DEPRECATED_POP_DISABLE()
void getMaxResolution(int &w, int &h, int &d) const
const RE_Texture * myEnvMap
void setDir(const UT_Vector3 &dir)
void setDownscale(fpreal scale)
GLdouble GLdouble GLdouble z
const RE_Texture * getEnvironmentMap() const
void setLights(UT_Array< GU_PrimVolumeCacheLight > &lightlist)
void setShadowIntensity(float shadow)
GLboolean GLboolean GLboolean GLboolean a
void setOrientation(const UT_Matrix3 &mat)
void setPreMultiply(bool premultiply)
void setOrg(const UT_Vector3 &org)
GU_PrimVolumeCacheRamp * myEmissionCdRamp
float getConeDelta() const
void setEnvironmentMap(const RE_Texture *env)
GU_PrimVolumeCacheRamp * myEmissionRamp
const UT_Matrix3 & getOrientation() const
float getEmissionScale() const
bool hasAttenuation() const
GU_ConstDetailHandle getIsoSurface() const
#define THREADED_METHOD3(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
UT_VoxelArrayReadHandleF myEmissionHandle
UT_VoxelArrayV4 * getShadedVoxels(bool *reduced=nullptr) const
GA_API const UT_StringHolder scale
UT_Vector4T< float > UT_Vector4
const UT_Vector3 & getCd() const
GU_PrimVolumeCacheRamp * myDensityRamp
float getShadowScale() const
void setConeRolloff(float rolloff)
void setMaxResolution(int w, int h, int d)
void setConeDelta(float delta)
const float * getCornerAttenuation() const
HUSD_API bool eval(VtValue &val, T &ret_val)
#define SYS_DEPRECATED_HDK(__V__)
void setIsInfinite(bool isinf)
GLboolean GLboolean GLboolean b
void setIsHeadlight(bool hl)
float getConeRolloff() const
#define THREADED_METHOD2_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
bool getPreMultiply() const
UT_Array< GU_PrimVolumeCacheLight > myLightList
GLfloat GLfloat GLfloat GLfloat h
GA_API const UT_StringHolder parms
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
UT_Vector3 getIsoCd() const
void setIsCone(bool cone)
Utility class for containing a color ramp.
float myAttenuationCoeffs[3]
const GEO_Primitive * myDensityField
bool operator==(const GU_PrimVolumeCacheLight &l) const
void setIsoPoints(bool iso_pts)
float * getAttenuationCoeffArray()
const GEO_Primitive * densityField() const
void setCornerAttenuation(float a[8])
GLubyte GLubyte GLubyte GLubyte w
UT_VoxelArrayV4 * myVoxels
UT_VoxelArrayReadHandleV4 myDiffuseHandle
float getConeAngle() const
GU_PrimVolumeCacheRamp * myDiffuseRamp
void setCached(bool b) const
UT_Vector3I getRes() const
The cached resolution.
bool isEnvironment() const
UT_VoxelArrayReadHandleF myDensityHandle
UT_VoxelArrayReadHandleV4 myEmissionCdHandle
GU_PrimVolumeCacheLight()
Environment light. Infinitely far away incoming rays from all directions.
GEO_PrimVolumeXform getSpaceTransform() const
int64 getMemoryUsage(bool inclusive) const
const UT_Vector3 & getDir() const
void setConeAngle(float angle)
~GU_PrimVolumeCacheParms() override