Re: adding vertex at render

"res" <[email protected]>
Newsgroups gmane.comp.graphics.crystalspace.devel
Message-ID <[email protected]>
>     Do i have to take care of vertex buffer if i add vertex to an ocean
> cell at Render( i mean in method GetRenderMeshes )? 

Well, depends. If you need a “new” coordinate (not in the buffer for the node yet) you'll have to add a new entry to the vertex buffer.
If the coordinate in question is already there, you can just re-use the same index (and just have to extend the indices with a new triangle).

If in doubt, assume you have have to add a new vertex to the vertex buffer. If you think that adds some redundancy (same coordinate used twice) it can still be optimized once you're sure everything works as intended.


However, not sure that GetRenderMeshes() is the right place to fiddle with the vertex buffers... as you can see, the mesh factory essentially pre-computes the number of vertices the mesh object needs. So what you could do is to add the number of extra boundary vertices needed there (number of vertices on the edge of the node, times two [since only at most two edges are close to the viewer and thus need the extra vertices]), and fill them in the mesh object as needed.
You may not have to provide these extra vertices in all cases, but it's less of a problem to have a vertex buffer that is too large (and where some vertices are unused) than having to enlarge an existing buffer.

> i wanted to do this to
> increase vertex count at boundaries of an ocean cell so that it appears
> connected. kind of like
> [This]<http://img703.imageshack.us/img703/7939/untitle5d1.jpg>
> nvidia is using two Draw calls one for inner meshes and one for outer
> meshes. i'm not sure if same implementation could be possible in CS.

Would be nice to have that. The hardest part is probably that the boundary, and boundary only, needs a higher resolution.

>  what is the difference between 'factory->isOcean()' and 'isOcean()'?

I see only one “isOcean()” (in the factory), so presumably the first one is to call isOcean() outside the factory class, the second one is to call it inside the factory class...

> some other notes:-
> 
> =  there was a slight jerk as we move along the ocean. I fixed it. wasn't
> a
> big deal but atleast i understood the code.  :)

Cool.
Now don't forget to check in the changes you've made. :)

Generally try to check in early & often; for you, it means you actually have revisions of your changes, so you can e.g. go back a step if you find that something you did doesn't work. For us it means we can track your progress, but also review your work. And so the sooner you check something in, the sooner the changes can be reviewed and possible issues can be addressed.

> =  i found that if statement at line 886 of watermesh.cpp has
> no significance.

There's no “if” statement at that line ... for me. Probably because the line numbers shifted in your sources.
(Another reason to check in, so we can talk about the same code base ;)

-f.r.


-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

------------------------------------------------------------------------------
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.