using namespace HDK_Sample;
{
}
SNOW_Solver::~SNOW_Solver()
{
}
SNOW_Solver::getSolverSNOWDopDescription()
{
};
"hdk_snowsolver",
"SNOW Solver",
classname(),
theTemplates);
return &theDopDescription;
}
{
if( !rand )
return rand;
}
bool
{
if (dv)
{
v += dv;
return false;
}
else
{
if (v < 0)
v = 0;
if (v >= max)
v = max - 1;
}
return true;
}
int
int sx, int sy, int sz,
int dx, int dy, int dz,
int &rx, int &ry, int &rz,
int maxdist,
{
while (1)
{
return maxdist;
return maxdist;
return maxdist;
{
break;
}
dist++;
}
rx = sx;
ry = sy;
rz = sz;
}
void
{
int end_x[6], end_y[6], end_z[6], dist[6];
int dxvals[6] = { -1, 0, 0, 1, 0, 0 };
int dyvals[6] = { 0, -1, 1, 0, 0, 0 };
int dzvals[6] = { 0, 0, 0, 0, 1, -1 };
for (direction = 0; direction < 6; direction++)
{
x, y, z,
dxvals[direction], dyvals[direction], dzvals[direction],
end_x[direction], end_y[direction], end_z[direction],
mindist,
rand);
if (dist[direction] < mindist)
{
}
}
if (mindist == 320000)
{
}
else
{
}
}
int
{
int choice = rand->
choice(numchoice);
return choice;
}
void
int y, int z,
{
int sx = (
int)(startx * xdiv);
int ex = (
int)(endx * xdiv);
if (sx < 0) sx = 0;
if (sx >= xdiv) return;
if (ex < 0) return;
if (ex >= xdiv) ex = xdiv - 1;
{
for (int x = sx; x < ex; x++)
{
}
}
{
for (int x = sx; x < ex; x++)
{
}
}
}
void
{
{
fxform = xform;
if (bminx < 0) bminx = 0;
int bmaxx = (
int)
SYSceil(bbox(0, 1) * (xdiv + 1));
if (bmaxx >= xdiv) bmaxx = xdiv-1;
if (bminy < 0) bminy = 0;
int bmaxy = (
int)
SYSceil(bbox(1, 1) * (ydiv + 1));
if (bmaxy >= ydiv) bmaxy = ydiv-1;
if (bminz < 0) bminz = 0;
int bmaxz = (
int)
SYSceil(bbox(2, 1) * (zdiv + 1));
if (bmaxz >= zdiv) bmaxz = zdiv-1;
xdir.multiply3(xform);
for (int z = bmaxz; z >= bminz; z--)
{
orig.
z() = (z + 0.5) / (zdiv + 1);
for (int y = bminy; y <= bmaxy; y++)
{
orig.
y() = (y + 0.5) / (ydiv + 1);
if (numhit < 0)
return;
for (int hitnum = 0; hitnum <= numhit; hitnum++)
{
if (hitnum < numhit)
else
t = 1.0;
pos.x() = (t + lt) / 2.0;
xpos *= xform;
{
fillRow(snow, lt, t, y, z, voxeltype, rand);
}
}
}
}
delete isect;
}
}
void
{
tosnow.
scale(size.
x(), size.
y(), size.
z());
fpreal birthrate = getBirthRate();
for (int z = 0; z < zdiv; z++)
{
for (int y = 0; y <= ydiv; y++)
{
for (int x = 0; x <= xdiv; x++)
{
}
}
}
object.getAffectors(sourceaffectors, "SIM_RelationshipSource");
for (
int i = 0; i <
n; i++)
{
if (!geometry)
continue;
if (pos)
{
xform = worldtogeo * xform;
}
xform = tosnow * xform;
}
object.getColliderInfo(colliderinfo);
for (
int i = 0; i <
n; i++)
{
const SIM_Object *affector = colliderinfo(i).getAffector();
if (!geometry)
continue;
if (pos)
{
xform = worldtogeo * xform;
}
xform = tosnow * xform;
}
for (int y = 0; y < ydiv; y++)
{
for (int x = 0; x < xdiv; x++)
{
{
}
}
}
int dxvals[9] = { -1, -1, -1, 0, 0, 0, 1, 1, 1 };
int dyvals[9] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 };
int validdxidx[9];
int numdxidx, dxidx;
#if 1
for (int z = 1; z < zdiv; z++)
{
int yend, ystart, yinc;
int xend, xstart, xinc;
if (z & 1)
{
ystart = 0;
yend = ydiv;
yinc = 1;
xstart = 0;
xend = xdiv;
xinc = 1;
}
else
{
ystart = ydiv-1;
yend = -1;
yinc = -1;
xstart = xdiv-1;
xend = -1;
xinc = -1;
}
for (int y = ystart; y != yend; y += yinc)
{
for (int x = xstart; x != xend; x += xinc)
{
{
numdxidx = 0;
for (dxidx = 0; dxidx < 9; dxidx++)
{
y + dyvals[dxidx],
{
validdxidx[numdxidx++] = dxidx;
}
}
if (numdxidx)
{
dxidx = validdxidx[dxidx];
y + dyvals[dxidx],
y + dyvals[dxidx],
z-1);
}
}
}
}
}
#endif
}
void
{
if (voxelarray)
{
int depth = getOriginalDepth();
for (
int z = 0; z <
SYSmin(depth, zdiv); z++)
{
for (int y = 0; y < ydiv; y++)
{
for (int x = 0; x < xdiv; x++)
{
}
}
}
}
}
bool isnewobject)
{
if (!snow)
{
}
if (snow)
{
if (isnewobject)
{
setVoxelArrayAttributes(snow);
}
else
{
solveForObject(object, *snow, timestep);
}
}
}
myVoxelArray(0)
{
}
SNOW_VoxelArray::~SNOW_VoxelArray()
{
freeArray();
}
SNOW_VoxelArray::getVoxelArrayDopDescription()
{
};
"hdk_snowvoxelarray",
"SNOW VoxelArray",
"SnowValue",
classname(),
theTemplates);
return &theDopDescription;
}
void
{
if (!name ||
{
freeArray();
}
}
{
if (!myVoxelArray)
allocateArray();
}
void
{
if (!myVoxelArray)
allocateArray();
}
{
return myDetailHandle;
}
void
SNOW_VoxelArray::freeArray() const
{
delete myVoxelArray;
myVoxelArray = 0;
}
void
SNOW_VoxelArray::allocateArray() const
{
int divx =
SYSmax((
int)div.
x(), 1);
int divy =
SYSmax((
int)div.
y(), 1);
int divz =
SYSmax((
int)div.
z(), 1);
myVoxelArray->
size(divx, divy, divz);
}
SNOW_VoxelArray::createOrFindPoint(
GU_Detail *gdp,
int x,
int y,
int z)
{
exint idx = (
exint(z) * (ydiv + 1) + y)*(xdiv + 1) + x;
if (it != myPointHash.end())
{
return it->second;
}
#if defined(HOUDINI_11)
#else
#endif
v -= 0.5;
v *= getSize();
v += getCenter();
myPointHash[idx] = ptoff;
return ptoff;
}
void
int x0, int y0, int z0,
int x3, int y3, int z3)
{
ptoff = createOrFindPoint(gdp, x0, y0, z0);
ptoff = createOrFindPoint(gdp, x1, y1, z1);
ptoff = createOrFindPoint(gdp, x2, y2, z2);
ptoff = createOrFindPoint(gdp, x3, y3, z3);
}
void
SNOW_VoxelArray::buildGeometryFromArray()
{
{
int xstep = 1;
int ystep = 1;
int zstep = 1;
if (xdiv > 64)
xstep = xdiv / 64;
if (ydiv > 64)
ystep = ydiv / 64;
if (zdiv > 64)
zstep = zdiv / 64;
for (int z = 0; z < zdiv; z+=zstep)
{
for (int y = 0; y < ydiv; y+=ystep)
{
for (int x = 0; x < xdiv; x+=xstep)
{
{
{
buildFace( gdp, x, y, z,
x, y+ystep, z,
x, y+ystep, z+zstep,
x, y, z+zstep );
}
{
buildFace( gdp, x+xstep, y, z,
x+xstep, y, z+zstep,
x+xstep, y+ystep, z+zstep,
x+xstep, y+ystep, z );
}
{
buildFace( gdp, x, y, z,
x, y, z+zstep,
x+xstep, y, z+zstep,
x+xstep, y, z );
}
{
buildFace( gdp, x, y+ystep, z,
x+xstep, y+ystep, z,
x+xstep, y+ystep, z+zstep,
x, y+ystep, z+zstep );
}
{
buildFace( gdp, x, y, z,
x+xstep, y, z,
x+xstep, y+ystep, z,
x, y+ystep, z );
}
{
buildFace( gdp, x, y, z+zstep,
x, y+ystep, z+zstep,
x+xstep, y+ystep, z+zstep,
x+xstep, y, z+zstep );
}
}
}
}
}
}
}
void
{
BaseClass::initializeSubclass();
freeArray();
}
void
{
BaseClass::makeEqualSubclass(source);
if( srcvox )
{
setDivisions(srcvox->getDivisions());
if (srcvox->
myVoxelArray)
{
allocateArray();
*myVoxelArray = *srcvox->myVoxelArray;
}
else
{
freeArray();
}
}
}
void
{
BaseClass::saveIOSubclass(os, io);
os << "{\n";
for (int z = 0; z < zdiv; z++)
{
for (int y = 0; y < ydiv; y++)
{
os << "\t";
for (int x = 0; x < xdiv; x++)
{
}
os << "\n";
}
}
os << "}\n";
}
bool
{
if (!BaseClass::loadIOSubclass(is, io))
return false;
int x = 0;
int y = 0;
int z = 0;
{
{
while (idx < arraysize && bufis)
{
if (bufis >> value)
{
idx++;
x++;
if (x >= xdiv)
{
x = 0;
y++;
if (y >= ydiv)
{
y = 0;
z++;
}
}
}
}
}
}
return true;
}
{
int64 mem =
sizeof(*this);
if (myVoxelArray)
{
}
return mem;
}
void
{
BaseClass::handleModificationSubclass(code);
}
void
{
if (!myVoxelArray)
return;
myVoxelArray->collapseAllTiles();
}
{
myArray = 0;
}
SNOW_Visualize::~SNOW_Visualize()
{
}
SNOW_Visualize::getVisualizeDopDescription()
{
static PRM_Name theGuideBox(
"usebox",
"Bounding Box");
};
};
"hdk_snowvisualize",
"SNOW Visualize",
"Visualization",
classname(),
theTemplates);
theDopDescription.setGuideTemplates(theGuideTemplates);
return &theDopDescription;
}
{
}
void
{
if (!cdh.isValid())
{
#if defined(HOUDINI_11)
static float one[3] = { 1, 1, 1 };
#else
#endif
}
for (int idx1 = 0; idx1 < 8; idx1++)
{
pos.
x() = (idx1 & 1) ? bbox.
xmax() : bbox.
xmin();
pos.
y() = (idx1 & 2) ? bbox.
ymax() : bbox.
ymin();
pos.
z() = (idx1 & 4) ? bbox.
zmax() : bbox.
zmin();
cdh.set(corners[idx1], color);
}
for (int idx1 = 0; idx1 < 8; idx1++)
{
for (int idx2 = idx1+1; idx2 < 8; idx2++)
{
switch (idx1 ^ idx2)
{
case 1:
case 2:
case 4:
{
break;
}
}
}
}
}
void
{
if (!myArray)
return;
return;
bbmin = myArray->getCenter();
bbmax = bbmin;
bbmin -= myArray->getSize()*0.5;
bbmax += myArray->getSize()*0.5;
if (!cdh.isValid())
{
}
for (int z = 0; z < divz; z++)
for (int y = 0; y < divy; y++)
for (int x = 0; x < divx; x++)
{
{
cdh.set(ptoff, color);
v -= 0.5;
v *= myArray->getSize();
v += myArray->getCenter();
}
}
if (getUseBox(options))
}
void
{
BaseClass::initializeSubclass();
myArray = 0;
}
bool
{
return true;
}
void
{
myArray = sf;
}
void
{
}