* Builds the vertices needed for the sky dome. This is not the same as the
* geometry, since that needs to be constructed using a triangle fan and a bunch
* of triangle strips.
*/
vertices = new Point3f[numVertices];
radius /= (float)Math.cos (radAngle);
//
// Compute the y adjustment
//
// From the resolution, compute the angular sweep of one section
// of the dome
//
float horzSweep = (float)Math.toRadians(90.0f / resolution);
vertSweep /= resolution;
vertSweep = (float)Math.toRadians(vertSweep);
// Start the vertex list with the very top of the dome
//
vertices[0].add(origin);
for (int i = 0; i < resolution; i++)
{
// Compute the vertex that will be rotated around to make a ring
//
Matrix3f m = new Matrix3f();
m.rotZ(vertSweep * (i + 1));
m.transform(vPoint);
vPoint.y = (vPoint.y - yAdj) * heightScale;
// Loop through the ring creating the points
//
{
// Map the point
//
vertices[nVertex] = new Point3f();
m.transform (vPoint, vertices[nVertex]);
vertices[nVertex].add(origin);
nVertex++;
}
}
numFanVertices = resolution * 4 + 1 + 1;
numStrips = resolution-1;
stripCount = new int[numStrips];
// Loop through squares
//
int nDelta = resolution * 4;
for (int j = 1; j < resolution; j++) {
int nStart = nDelta * j + 1;
int nEnd = nStart + nDelta;
stripCount[j-1] += 2;
}
stripCount[j-1] += 2;
numStripVertices += stripCount[j-1];
}
drawCoord(dome.vertices[0], this);
for (int i = 1; i < dome.resolution * 4+1; i++)
drawCoord(dome.vertices[i], this);
drawCoord(dome.vertices[1], this);
for (int j = 1; j < dome.resolution; j++)
{
int nStart = nDelta * j + 1;
int nEnd = nStart + nDelta;
for (int i = nStart; i < nEnd; i++)
{
drawCoord(dome.vertices[i - nDelta], this);
drawCoord(dome.vertices[i], this);
}
drawCoord(dome.vertices[nStart - nDelta], this);
drawCoord(dome.vertices[nStart], this);
}
// offset.normalize();
offset.x *= timeInDays;
offset.y *= timeInDays;
sTexShift = 0.5f + speed.x * timeInDays;
tTexShift = 0.5f + speed.y * timeInDays;
sTexture.set(tscale,0,0);
tTexture.set(0,0,tscale);
dayFactor = (float)Math.pow (dayFactor, transitionExp);
if (dayFactor>1) dayFactor = 1;
else if (dayFactor<0) dayFactor=0;
else if (dayFactor==1) curColor.set(dayColor);
else curColor.interpolate(nightColor,dayColor,dayFactor);
if (curColor.w==0) rapp.setVisible(false);
else rapp.setVisible(true);
}
if (!verticesSet) g.setCoordinate(p);
g.setColor(curColor);
texCoord.x = vpoint.dot(sTexture) + sTexShift;
texCoord.y = vpoint.dot(tTexture) + tTexShift;
g.setTexCoord(texCoord);
-----Original Message-----
From: Smith, Daniel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 10:44 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Background node problemsI'm working on Background node geometry, and I don't want to waste CPU with those extra Sphere polys below the horizon that will never be seen...
I'm trying to create a slightly flattened, low-poly hemisphere for a skybox/cloud layer, and I want it as background so the Fog node won't affect it (if there's a work-around let me know!). I have this working as normal geometry, but fogging is very inconsistent across the relatively large polygons that stretch into the distance...
Has anyone had luck creating background geometry other than a sphere? Do all points have to live on (or within) 1.0 units from the origin? I can't find any good documentation on it, and every attempt I make results in no geometry being shown...
Also-anyone know of a good sphere or hemisphere geometry generating algorithm that can generate tex coords too (or be modified to do so?)
Scott
