• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

138 Neutral

About stu_pb

  • Rank
  1. I don't think you will be able to do that. What you are trying to do is similar to using the "where" clause (see below) on the generic declaration, but since the PositionTextured and other vertex format structs are not derived from a common base class there is no type to use. public class MyClass<T> : where T : MyBaseClass... This class declaration will insure that only objects of type T or derived are allowed. I think this is true but I could be wrong.
  2. [MDX]: DirectX service

    Sounds like I will create a hidden, never visible window, Thanks
  3. Is it possible to create a DirectX device without a device window handle? What I want to do is have a device that always renders to a texture, never to a Control. The code below does not work. PresentParameters presentParameters = new PresentParameters(); presentParameters.SwapEffect = SwapEffect.Discard; presentParameters.IsWindowed = true; try { _device = new Device(0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.SoftwareVertexProcessing, presentParameters); } catch (DirectXException) { } Thanks!
  4. I went with the Unproject method to calculate a ray from the mouse pointer in the direction of the pointer. Ultimately I wanted to be able to pick individual vertices in a terrain, so I calculated the distance from the vertices to the ray and then selected those within a certain tolerance, then I selected the closest vertex to the camera from those that were on the ray. It seems to work pretty well, but if you know a better way let me know! Thanks
  5. Thanks for the code, I will try this out when I get home, It looks very similar to what I have with a couple of twists, so I think this might do it.
  6. What I am really after is this code converted into C# and managed DirectX. It calculates a ray through the view frustum from the point clicked with the mouse (x,y). void calcRay(int x,int y,D3DVECTOR &p1,D3DVECTOR &p2) { float dx,dy; D3DMATRIX invMatrix,viewMatrix; dx=tanf(FOV*0.5f)*(x/WIDTH_DIV_2-1.0f)/ASPECT; dy=tanf(FOV*0.5f)*(1.0f-y/HEIGHT_DIV_2); lpDevice->GetTransform(D3DTRANSFORMSTATE_VIEW,&viewMatrix); D3DMath_MatrixInvert(invMatrix,viewMatrix); p1=D3DVECTOR(dx*NEAR,dy*NEAR,NEAR); p2=D3DVECTOR(dx*FAR,dy*FAR,FAR); D3DMath_VectorMatrixMultiply(p1,p1,invMatrix); D3DMath_VectorMatrixMultiply(p2,p2,invMatrix); } [Edited by - stu_pb on May 10, 2006 2:27:00 PM]
  7. What is the managed directx 2.0 equivalient of the D3DMath_VectorMatrixMultiply method? Thanks
  8. I wanted to do this so I could use inheritance when rendering objects. Vertex (Position) Texture1Vertex (Position and 1 Texture) Texture2Vertex (Position and 2 Textures) . . . My rendered objects could than have an array of Vertex objects that can be any of the derived Vertex types.
  9. I want to use a GraphicsBuffer<> generic with a class instead of a struct to populate a vertex buffer. Is this possible? Is there another way to load the VertexBuffer without using the GraphicsBuffer<> generic? Basically I want to create vertex objects that are classes instead of structs. This is the code that doesn't work: [source language="c#"] using (GraphicsBuffer&lt;Vertex&gt; buffer = Vb.Lock&lt;Vertex&gt;(0, 0, LockFlags.None)) { buffer.Write(_vertices); Vb.Unlock(); } Where Vertex is a reference type instead of a value type. Thanks
  10. I really didn't think anyone would buy it, it was worth a try though! I am still creating it because it will help me out in the long run. Thanks.
  11. I have always rewritten the extensibility code, ie. a plugin manager, the plugin host and the plugin interface. I have also rewritten how the plugins access the main application, before I did this through custom methods in the plugin host. In my new framework there will be methods for adding menu items, toolbars and controls to the main form. By command based I mean that all functionality derives from a base ICommand interface. When the user clicks the file.open menu item a command is executed. My new framework will allow developers to capture events before and after the open command is executed, allowing for extending the functionality of the command. The framework will also allow developers to create new commands that can be attached to menu items, toolbars, controls, etc... As long as the command name(id) is known, a developer can call it and extend it, this will allow one plugin to extend the functionality of another. I see this framework as a good starting point for game developers to create their editors. It would provide an easy to use tool that would allow a team of developers to quickly extend functionality written by any developer.
  12. I am creating a framework for building extensible windows forms applications in .NET. I am doing this since I end up generating similar code for every window's app I create. The framework will be command based, similar to the Visual Studio IDE. A plugin for the application will be able to execute commands, extend existing command functionality, and generate new commands. Do you think this is something other developers would be interested in purchasing for a small fee (~$10 - $20USD)? Is their something similar to this out there that is in the same price range? Thanks!
  13. My guess is that _jinx_ eluded to the issue when he said there may not be enough RAM on the server. When you change the select to an indexed column you see the performance you desire, with the non-indexed column you don't, this is because the indexed column is in memory, but the non-indexed column is not. When you select the non-indexed column it must be read from disk which = slow! You also state that from a table with 36000 records the query performs well. This is more evidence that memory is the issue. Here all columns are able to be put in memory, not just the indexed ones. Good Luck!
  14. C# Game Programming

    I think learning how to architect a game engine is far more important than the language you choose to write it in. A well written C# engine can be a lot faster than a poorly written C++ engine. I don't think that switching between the two languages, if the need arose, would be that big of a deal.
  15. If you are worried about changing the structure of the class later on you should save your class in an extensible format like XML. This will require you to write your own serialization functions using .NET's stream objects. If you decide to use XML use can use .NET's built in XML objects (XmlDocument,etc.) <MyObject> <Variable1 value="1"/> <Variable2 value="2"/> <SubObject1> <SubVariable1 value="1"/> </SubObject1> </MyObject>
  • Advertisement