lil confused

Naman Gupta <[email protected]>
Newsgroups gmane.comp.graphics.crystalspace.devel
Message-ID <CAJ4hSG1RGpUq1eXFdXJVK3RRNRAWLMKYKF4kD3BO2481O9yQLw@mail.gmail.com>
Hey Guys,

    i'm trying to a mesh for ocean that has 2x vertices at boundaries. i'm
lil confused with tris.


   Here is where the vertices and tris are setup.


gran = 0.1f;  // this actually sets the no of vertices/tris in a mesh (or
LOD). 0.1f is set for testing. it'll produce a square mesh with 9
vertices(3x3) and 8 tris .

    uint maxjd = (uint) (len * gran);
    uint maxj = maxjd + 1;
    uint maxid = (uint) (wid * gran);
    uint maxi = maxid + 1;

 for(uint j = 0; j < maxj  ; ++j)
    {
      for(uint i = 0; i < maxi ; ++i)
      {
        verts.Push(csVector3 ((i * wid / maxid), oHeight, (j * len /
maxjd)));
        norms.Push(csVector3 (0, 1, 0));
        cols.Push(csColor (0.17f,0.27f,0.26f));
        texs.Push(csVector2((i * wid / maxid) / 1.5, (j * len / maxjd) /
1.5));
      }
    }


     for(uint j = 0; j < maxjd; ++j)
        {
          for(uint i = 0; i < maxid; ++i)
          {
            tris.Push(csTriangle ((int)(j * maxi + i),
                        (int)((j + 1) * maxi + i),
                        (int)(j * maxi + i + 1)));
            tris.Push(csTriangle ((int)(j * maxi + i + 1),
                        (int)((j + 1) * maxi + i),
                        (int)((j + 1) * maxi + i + 1)));


                       //  debug  code
csPrintf("\nFirst  tri x= %d y=%d z=%d\nSecond tri x= %d y=%d z=%d",
(int)(j * maxi + i),
(int)((j + 1) * maxi + i),
 (int)(j * maxi + i + 1),
(int)(j * maxi + i + 1),
(int)((j + 1) * maxi + i),
 (int)((j + 1) * maxi + i + 1) );
                     //  debug code
          }
        }


after executing, debug code results  ( for one oceancell)

First      tri x=0 y=3 z=1
Second tri x=1 y=3 z=4
First      tri x=1 y=4 z=2
Second tri x=2 y=4 z=5
First      tri x=3 y=6 z=4
Second tri x=4 y=6 z=7
First     tri x=4 y=7 z=5
Second tri x=5 y=7 z=8

i can't figure out how these tris are working. they are not xyz for sure.



-Naman

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Crystal-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.