• Advertisement


  • Content count

  • Joined

  • Last visited

Everything posted by _DarkWIng_

  1. Hi. I have an array of structures that I need to cast to array of raw data bytes so it can be passed to a dll (not mine). There are number of different structures (like vector2, vector3,..) that need to be transforemed this way and I was wondering if there is a safe generic solution to this or will I have to write custom function for each type. I've tried using: DataType[] buffer; //.. create and fill buffer... MemoryStream ms = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize( ms, buffer ); byte[] temp = ms.ToArray(); But this will full array with other serialization info (object type?). Is there a way to serialize data fields only? Thanks.
  2. Quote:Original post by jteeuwen The extra info that the (de)Serialization methods use cannot be ommited. The Framework needs this info in order to read the serialized data back into your app properly. I wish it could be omited if the I had no intention of deserializing the objects back (my opertion is one-way). I guess I will use the RawSerialize function from other thread to serialize each object in array and add them together. I was just hoping for something faster.
  3. I just remembered that the code for this is also included in source last demo Tranquillity so you can grab it from there.
  4. post if you hate to document

    Quote:Original post by benryves Documenting code for me (eg /// <summary> tags) is good. Documenting my applications for end users is bad. Same here. I document my code very strictly, but I really hate writing documentation for the dumb users. Not to mention that I have to localize it for 2 different languages. Plain simple boring.
  5. You have mail! I only implemented sky colors.
  6. I can't help you with your code but I can send you my implementation of that paper. It's a bit to much to post it here.
  7. Sky system.

    There are also some nice links in Forum FAQ.
  8. Quote:Original post by Flimflam The only thing I entirely dislike about .NET is it's inharent inability to easily work with binary files, not having to load one value at a time. That has always put me off the .NET api, even though I have learned it. The pressure on using XML and other such text-based files really upsets me. This should help you. Using C# 2.0 you can write a generic function that can read any type(struct) from binary file.
  9. I wouldn't learn it. Consider how much do you need it when writing a new program/game in C# from zero? You might need a function or two that isn't exposed trough .net but when that time comes you just look it up in MSDN. I would rather start learning something newer. PS: And about Vista. Sure they will keep winAPI (or at least emulate it), but why on earth would you use it to write new programs since there other *much* better options.
  10. Blurring

    I'm glad to hear it worked so fine for you. One more thing you can do is to blur it twice (or even more times) with smaller kernel. Something like 5x1 + 1x5 + 5x1 + 1*5 + ... You can just ping-pong the buffers. And actually separating 2D Gauss in 2x 1D is not fake but mathematically correct.
  11. Blurring

    I used something like Red_falcon's idea in my demo and it works just fine. You also have to remember that you can separate 2D Gauss to 2x 1D. Implementing this gives a nice performance bonus. (for 16x16 kernel you only need 32 samples.. quite a save)
  12. a _BETTER_ random number generator?

    Quote:Original post by Rattrap Usually you just take use a modulous operation For the n-th time : no. Using mod operator screws up distribution no matter how good your RNG is. Use something in the lines : value = random() / max_random_number * max_desired_value edit: Matt Apple gives a nice example of this use.
  13. [.net] Regular Expression Problem

    Try something like: return Regex.IsMatch( "0123456789012", @"^([0-9]{11})$" ); or even return Regex.IsMatch( "0123456789012", @"^(\d{11})$" );
  14. Octree/Polygon splitting

    @rgirard413: Looks like your problem is in creation of octree nodes. You should never have triangles that are outside the node intersecting it. You'll have to modify box-triangle collision/intersection routine so it finds such cases as described. Searching Google for AABB-triangle should give some nice results. @paic: We all know splitting triangles is bad. That's why I suggest him to look at the spatial structures that minimize the number of splits needed. Going for octree to loose-octree can simply reduce number of splits by over 90% with only a few % overgrowth.
  15. Octree/Polygon splitting

    Quote:Original post by paic when a triangle is in more than 1 node, you can simply duplicate the triangle to include in each node. This is a bad solution for any modern engine. Sure it may be easy to implement but it will cause sou much trouble in the long run. Just think about blending/transparency. @rgirard413: You either split it in nodes or use a bit different spatial structure like loose octrees or ABTs.
  16. [.net] C# and marshaling

    This might help a bit : C# and advanced binary files.
  17. Crystal Reports - What is it?

    They are used mostly for creating nice reports usually used for printing on either normal paper of directly into forms (like bills, cheques or things like that). They get their data mainly form database(stored procedures)/datasets or even local objects. Someone using them on dally bases could explain a bit better (I only work with them from time to time)
  18. C# Compiler

    Visual C# Express
  19. Is there any chance of you will be releasing this control? I know there are a lot of people in need of such user control.
  20. Vertically flip TGA data

    You need to flip row-by-row, not pixel-by-pixel.
  21. feasability of skysphere to skybox

    Quote:Original post by benjamin bunny You'll get far worse texture distortion with a sphere or a dome, especially at the top. You could still use cube map for base texture on skydome and get perfect texturing. Each has its own uses, its own advantages and disadvantages. Use the one that suits your needs.
  22. Simple Texture Class (Resolved)

    You can't use == on char*. Since you're using C++ you might as well dump char* and start using std::string. (I would also replace std::vector with some kind of hash table)
  23. Hi. I've been messing with designing engine layout for the application I'm working on. I've reused most of my old engine for it, only rewriting it to C#. I would like some feedback on this. Here is the UML diagram of a part of it. I will update it with any ideas given. The main class here is XScene. It holds a pool of light, cameras, renderers and scene elements. Scene elements are parts that actually hold the data about the scene and they come in many forms. Anything from sky systems, ABT's, quadtrees or any other spatial structure. On render they are transversed and the visible geometry is added to renderer. After that the renderer sorts the render lists and renders everything to it's bound render target. It worked quite well in last engine but now I have a bit of problems with some 'new' features I would like to add to it: -So far nodes are only frustum culled so I would like to have optional occlusion culling step. I have a bit of trouble figuring out where to insert it in as I would like to be as general as possible. -So far the lights are just stored in a list in the scene and are not tied to actual geometry. Everytime a object needs a light it goes trough that list to find it (for example to find closest 4 lights). This works if there are only 10 or so lights in scene but it really breaks down with large number of small lights. How do you handle large number of possibly dynamic lights? Any ideas are welcome!
  24. Engine design (UML inside)

    @nts: I'll think about your sencond idea (adding render occluders to scene elemnts) Quote:Original post by JD What about shadows coming from different areas outside the frustum? How could a light (and its shadow) that is not in frustum (== light's bounding voume does not intersects with view frustum) affect the scene? Am I missing a point here?
  25. Engine design (UML inside)

    @Koshmaar: I've checked out ORGE when I was studying Axiom. The engine looks nice and I did get some ideas from it, but none of them solve my biggest problems. I don't think lights sould be store in a specific scene elements as others don't (and shouldn't) have access to it. @andhow: It's true that UML gives only half the idea. Since I don't know how to draw diagrams for the rest of stuff I'll try to explain my ideas a bit better. Scene The scene class holds the information about everything that needs to be renderd and is basicly current state of the world. Most of data is held in a list of scene elements. There are 2 main functions that are exposed: -Update: Updates all render elements. -Render: Collect visible objects from render elements and render them. Scene Element This is a base class for all kinds of object/geometry data. I derived a bunch of classes from it like ABTs, QTs, sky domes, or just object pools. Until now they are responsible for -Updating the objects they hold, and -Sending objects to renderer Renderer Renderer collects objects from scene and scene elements. Once all objects are collected they are sorted by material (shader, texture,...) and vertex buffer they are renderd to the currenty binded render target. Renderer is based on shader system described by Yann L so it supports the pass bouncing and things like that. Now the problems with this design that I would like to fix: Culling & LOD Since now each scene element is doing it's own culling (only frustum so far). The problem come when I try to integrate a occlusion culling (or any other culling scheme) into play. If I add it to scene element, after frustum culling and before sending to renderer I lose the ability for object from one scene element to occlude the element from another scene element (like player hidden behind the hill). But if I add it to renderer (before sorting objects) I lose information that I could use for better LOD calculation. Ultimatly I would like to have some kind of 'culling chain'. I would link together for example sphere-frustum, box-frustum and HOM. Lights So far the lights are stored in a collection inside the actual scene objects. At render time visible & active lights are moved to temporary collection. This is not good for a couple of reasons: Scene elements have to access scene object and they have to iterate trough it each time to find anything. A solution I have in my head right now is some kind of light manager. It would hold lights in some kind of spatial structure to increase searching. One problem with them that I still have is how to effectivly handle rendering from multiple cameras, as each camera should have it's own 'visible lights list'. I hope this makes a bit more sense. I would really like to see some diagrams or (a bit more in-depth) descriptions now other handle this problem. PS: If anyone is using VS 2005 class designer/diagrams: how do you make it show arrows to interfaces (so it doesn't just name them). EDIT: @ffx: I'm studying his ideas now. It looks very nice so far. After reading that I'll probably change my design a bit.
  • Advertisement