loading assets from somewhere, but resources

Mar 22, 2010 at 1:17 AM

I've got 2 questions:

Can I load asset, for example, from stream or something like this? Maybe when user opens model from file system, or when it loads from some kind of db.

And can I disable calculating Game objects, for example when they leave the visible area, and resume calculations when it's visible again?

Mar 22, 2010 at 1:38 AM

sorry, i didn't notice this post. It's a pity that it can't be loaded from somewhere else. Is there no opportunity to create resource dynamically and use it for creating an asset?

Mar 23, 2010 at 8:02 AM

It is possible to do it, but you'd need to provide the entire data yourself.

A Geometry has a GeometryContext that has methods for adding vertices, faces, texture coordinates and such. You'd need to use this. 

This is on the radar however, and will be implemented - I just can't guarantee when.

Mar 23, 2010 at 1:17 PM


Its interesting that we can add vertices etc...

Im going to try that...

But after add them its possible to change its cooedinates, and if so, is it possible to alter existing vertices on a mesh?


Mar 23, 2010 at 5:36 PM

Indeed it is.    But not something I've been promoting too much. :) 

You can go and get all the vertices from the GeometryContext and you can individual vertices as well. 

Mar 23, 2010 at 7:42 PM

Cool, i was thinking of a Morph effect, but ill have to study how to implement....



Mar 25, 2010 at 4:13 AM
adept wrote:

You can go and get all the vertices from the GeometryContext and you can individual vertices as well. 


Interesting feature! Sample codes please..

Mar 25, 2010 at 8:44 AM

Its a secret. :) 

Just kidding.

Basically, the GeometryContext has a method called GetVertices() - that will return an array of vertices. If you want to change a vertex you can just access the array and inside the vertex you'll find a Vector containing the X,Y,Z for the vertex. To get it back to Silverlight and get it modified, you need to call the SetVertex() method with the index of the vertex you want to change and the vertex itself. The reason why you can't just change the vertex without pushing it back to the GeometryContext is that the GeometryContext is platform independent, typically on a hardware accelerated version of it, it would need to push the change into a vertex buffer on the graphics device. Also, the Vertex and Vector are both structs, value types.


Mar 25, 2010 at 7:43 PM

Thx for your responce, it's an interesting feature. And what about image processing? Is it calculated every delta time, or just when something is changed. If furst - is it possible to disable image update to save perfomance for other tasks (Right now i've got few game objects, that independently renders some models. Yet some of them might leave screen, so i don't know if they are being processed in this invisible state. If they are, i just wanted to manually stop that and resume when visible again.)

Mar 25, 2010 at 8:24 PM

If there are any triangles visible on the screen, rendering will happen. For now though, the objects vertices will be calculated no matter what, regardless of wether or not you're manipulating the vertices. This is because the frustum clipping is not completely implemented. When it is implemented it will be possible to check if the object is visible or not.

Mar 26, 2010 at 11:04 AM

thx for responce.