Thanks for the detailed answer Fabrice. I'm gonna work on this. Will
post the result when i get a class that does what i want. Thanks a
lot!

On May 2, 12:52 pm, Fabrice3D <[email protected]> wrote:
> > When you create the plane primitive,
> > you're asked how many width and height segments you'd like to have.
> > What is the purpose of these parameters?
>
> the higher the settings the higher the subdivision. more faces
>
> >  As far as i know, regardless of the number of segments, of the number of 
> > segments, a plane have only one submeshe and
> > subgeometry
>
> yes and no. Primitives are not builded to support high poly count yet. As 
> other generators/parser already do
> normally when reaching the max buffer size of 65k,(non shared faces 22,5k) a 
> second submesh is created.
> take a look at addFace method in PathExtrude for instance
>
> > What i wanted to do was to get the faces (or segments) of a primitive
> > and detect collisions with mouse and
>
> nothing stops you to do so, only this time faces are not defined as Faces 
> instances as in previous engines
>
> In submeshes you can find among other vectors, the basic face definition 
> (enough for your hittests) expressed in 3 vectors:
> the uv's, the vertices and indices. There are getters and setters for these.
>
> faces are defined by 3 indices in indices vector,
> so indices vector length / 3 gives you faces count.
>
> each indice multiplied by 3 points to a vertice.x in vertices vector
> so indice[0]*3 +1 give you the vertex  y and + 2  the vertex  z value
> to retreive uv's from uvs vector: multiply the indice value *2 gives to get 
> the uv.u, add one would give you the uv.v
> repeat same for the 3 indices to form the whole face.
>
> during loops to simplify code, we have added value objects in core.base.data
> Face, Vertex and UV, handy if you need to manipulate data. But again, these 
> are value objects, they are not used by the engine at all.
>
> > it seems like a lot of work (specially identifying the vertices)
>
> Yes GPU may give us speed and nice renderings, it indeed brings a shit load 
> of extra work :)
> We try to ease all these things but in many cases custom work is required...
>
> We've added Helpers in tools package as well, some might help you or get you 
> started to write your own.
>
> > change it's material when this happens.
>
> you cannot change materials per face. materials are to be set at mesh or 
> submesh level
> per face would be ridiculous, imagine howmany buffers and data you would need 
> on a million+ model...
> think instead in terms of mapping/material if you need to alter a face "color"
>
> I hope I haven't broken your enthousiasm too much :)
>
> Fabrice
>
> On May 2, 2011, at 4:57 PM, Agoth wrote:
>
>
>
>
>
>
>
> > Hi. I am curious about how to manipulate the subdivisions of an
> > primitive, in this case, a plane. When you create the plane primitive,
> > you're asked how many width and height segments you'd like to have.
> > What is the purpose of these parameters? As far as i know, regardless
> > of the number of segments, a plane have only one submeshe and
> > subgeometry (the plane itself), and you can't get the segments (faces)
> > as if they were one of those.
>
> > What i wanted to do was to get the faces (or segments) of a primitive
> > and detect collisions with mouse and change it's material when this
> > happens.
>
> > How can i do it? I'm betting that i have to get the individual
> > vertices forming the face/segment i want to change. If that's the way,
> > it seems like a lot of work (specially identifying the vertices). Is
> > that so? Any ideas? Thanks!

Reply via email to