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;
248 float rmin,
float rinvscale);
253 float rmin,
float rinvscale);
258 float rmin,
float rinvscale);
263 float rmin,
float rinvscale);
280 float rmin,
float rinvscale,
297 float rmin,
float rinvscale,
301 doHardenVectorAligned,
314 float rmin,
float rinvscale,
318 doHardenVectorUnaligned,
331 float rmin,
float rinvscale,
335 doHardenVectorAxisAligned,
350 float rmin,
float rinvscale,
354 doHardenVectorAxisUnaligned,
369 float rmin,
float rinvscale,
385 float rmin,
float rinvscale,
400 float rmin,
float rinvscale,
404 doHardenVectorAxisVDB,
417 float rmin,
float rinvscale,
421 doHardenVectorVectorVDB,
432 float rmin,
float rinvscale,
444 bool hasEmission()
const;
489 *reduced = myVolumeReduced;
506 {
return myVolumeXform; }
510 int64 mem = inclusive ?
sizeof(*this) : 0;
512 mem += myVoxels->getMemoryUsage(
true);
513 mem += myLightList.getMemoryUsage(
true);
515 mem += myTexture->getMemoryUsage(
true);
516 mem += myIsoSurf.getMemoryUsage(
false);
524 float shadowdensity);
533 void computeAlphaVoxelsPartial(
547 bool indexToPos(
int x,
int y,
int z,
UT_Vector3 &pos)
const;
548 bool posToIndex(
UT_Vector3 pos,
int &x,
int &y,
int &z)
const;
560 bool myVolumeReduced;
573 : myMaxResW(0), myMaxResH(0), myMaxResD(0)
577 , myPreMultiply(true)
583 { myLightList = lightlist; }
585 {
return myLightList; }
588 { myMaxResW =
w; myMaxResH =
h; myMaxResD = d; }
590 { w = myMaxResW; h = myMaxResH; d = myMaxResD; }
593 { myDownscale =
scale; }
595 {
return myDownscale; }
600 {
return myMax2DRes; }
620 mutable bool myCachedFlag;
void setIsEnvironment(bool env)
#define THREADED_METHOD8_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7, PARMTYPE8, PARMNAME8)
const float * getConstAttenuationCoeffArray() const
GU_PrimVolumeCacheParms()
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
#define THREADED_METHOD6_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6)
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
IMATH_NAMESPACE::V2f float
GU_PrimVolumeCacheRamp * myDensityRamp
float getShadowScale() const
#define THREADED_METHOD7_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3, PARMTYPE4, PARMNAME4, PARMTYPE5, PARMNAME5, PARMTYPE6, PARMNAME6, PARMTYPE7, PARMNAME7)
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
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