projects
/
vrfileman
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cyberenv
[vrfileman]
/
src
/
meshgen.cc
diff --git
a/src/meshgen.cc
b/src/meshgen.cc
index
412f763
..
b6ae0c8
100644
(file)
--- a/
src/meshgen.cc
+++ b/
src/meshgen.cc
@@
-16,6
+16,8
@@
static Vec3 sphvec(float theta, float phi)
void gen_sphere(Mesh *mesh, float rad, int usub, int vsub, float urange, float vrange)
{
void gen_sphere(Mesh *mesh, float rad, int usub, int vsub, float urange, float vrange)
{
+ if(urange == 0.0 || vrange == 0.0) return;
+
if(usub < 4) usub = 4;
if(vsub < 2) vsub = 2;
if(usub < 4) usub = 4;
if(vsub < 2) vsub = 2;
@@
-49,7
+51,7
@@
void gen_sphere(Mesh *mesh, float rad, int usub, int vsub, float urange, float v
*varr++ = pos * rad;
*narr++ = pos;
*tarr++ = normalize(sphvec(theta + 0.1f, (float)M_PI / 2.0f) - sphvec(theta - 0.1f, (float)M_PI / 2.0f));
*varr++ = pos * rad;
*narr++ = pos;
*tarr++ = normalize(sphvec(theta + 0.1f, (float)M_PI / 2.0f) - sphvec(theta - 0.1f, (float)M_PI / 2.0f));
- *uvarr++ = Vec2(u * urange, v * vrange);
+ *uvarr++ = Vec2(u / urange, v / vrange);
if(i < usub && j < vsub) {
int idx = i * vverts + j;
if(i < usub && j < vsub) {
int idx = i * vverts + j;