May 28, 2011 at 1:34 AM
Edited May 28, 2011 at 2:59 AM
I'm working on a project where I'm supposed to use Silverlight + 3D . Until now I used Balder for SL 4 so I couldn't enjoy the hardware acceleration. Now I moved to SL5 but I have problems with Balder. Here is my situation:
I have a class "Terrain" that extends Geometry. In the prepare method I call few other methods that alocates vertices, faces, indices, texture coordinates, etc. My terrain should be deformable (it was before moving to SL5). On click I should be able to Raise/Lower
terrain's vertices. This is no longer working with Balder for SL5. My Raise/Lower methods are called successfully, even the vertices are modified but I can't see the changes on screen. What I
also observed is that all properties in my geometry's FullDetailLevel (Terrain.FullDetailLevel) indicates 0 (VertexCount, FaceCount, LineCount, NormalCount, TextureCoordinateCount) despite the fact that all vertices,
faces, normals are set (looking in the private members). I tend to believe the problem is with GeometryDetailLevel.cs ... I looked at the code in this file and I can't see anything that sets those properties.
Can someone tell me where and what to change to fix this problem? Please don't let me staring in the code and trying to understand the whole structure. :(
Edit: My mistake! The properties are set correctly in GeometryDetailLevel.cs (the one for SL) BUT THAT'S WHY I was wrong. It looks like my FullDetailLevel is of type
Rendering.Xna.GeometryDetailLevel instead of
Rendering.Silverlight.GeometryDetailLevel. This may be the source of the problem...
Edit2: I found the problem :) Actually there are a couple and both in
1: Properties are not set (not so important)
2: In SetVertex() we have to unprepare vertices (_verticesPrepared = false;)