Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Slig Commando

Member Since 01 Sep 2010
Offline Last Active Jun 01 2014 07:01 PM

#5062174 My ever-evolving coding style

Posted by Slig Commando on 15 May 2013 - 08:22 PM

void frobnicate()
{
    CFoobar *foo = new CFoobar();
    
    //Fixed
    int* var = foo->GetFoo();
    *var += 7;

    double thing = *foo->GetBaz();
    // etc...
    
    delete foo;
}

 

Honestly I like returning pointers for most cases. Using the pointer you dont have to make a thousand function calls. Especially in parallel programming this is very useful when you want to avoid static variables. Sometimes its not a good idea, or not even possible depending on the use, but I believe this is a perfectly valid programming habit. IMO




#4935447 Very quick VertexBuffer question

Posted by Slig Commando on 27 April 2012 - 12:25 PM

You can create a large vertex buffer only once, and then depending on how many characters you need to draw ect... you simply change your offset, and size to draw in your draw call. As you already are aware, your current method has a huge impact on performance.

Another idea, you could fill up your vbuffer with a-z(once), and spell out your text using a single vbuffer using multiple draw calls.


#4923166 Input for a windows game

Posted by Slig Commando on 18 March 2012 - 07:52 PM

If you are creating an input system for a game, DO NOT use windows messages to handle such things. It is sloppy, and terrible to maintain, plus it is limiting in certain aspects of mouse control. Create a wrapper class that uses RawInput for best results. If you are having trouble figuring it out, just keep it up and you will eventually figure it out. I am not at my work computer right now, other wise I would post some code and explanations, but RawInput is pretty simple to use once you figure it out, plus it is much more versatile and powerful than standard windows messages.


#4913728 Hitting Unhandled exception on IDirect3DVertexBuffer9::Unlock()

Posted by Slig Commando on 16 February 2012 - 01:13 PM

since that can give a clue about the cause (E.g. an access violation reading an address near 0x00000000 means you probably tried to dereference a null pointer).


I would like to think my debugging skills could find a simple problem like that =P


#4913550 Hitting Unhandled exception on IDirect3DVertexBuffer9::Unlock()

Posted by Slig Commando on 15 February 2012 - 08:58 PM

I solved my problem, I was copying to an incorrect buffer. I ran this through PIX and it seems to be working as expected =) good day all!


#4900544 Shader Animation

Posted by Slig Commando on 07 January 2012 - 11:14 PM

Usually when doing GPU skinning, you dictate a maximum number of bone associations per vertex. The most common value I've seen for this is 4, which only requires one 4D texcoord to hold the bone indices and one 4D texcoord to hold the weights.

IIRC DirectX9 cards must support a minimum of 256 float4 constants (though specific cards may provide more, which you can see with D3DCAPS9.MaxVertexShaderConst).

If you represent your bones as mat4x4's, then you can only fit 64 (and no other data). Usually, you'll "compress" them into mat4x3's instead, so you can fit up to ~80 bones. There are also more advanced compressions like dual-quaternions, that get up to 128 bones if your math is up to the job ;)

Usually if bone-limits become a problem, then you simply split the mesh into two parts and draw it in two draw-calls, each with a section of the skeleton.


Thank you for the response, you answered my question exactly as I was concerned. Thanks =)


#4898576 Skeletal animation system

Posted by Slig Commando on 31 December 2011 - 06:47 PM

So in the pursuit of knowledge and a higher understanding of how "games" work, I have been developing a homemade game engine and am starting work on a skeletal animation system. I did some research on this and looked into how this concept is generally tackled. You have a hierarchy of bones, each with one parent, and possible multiple children. So when you transform a bone in 3d space, that bone's children, and the children of the children all are affected. My only loose end, is I do not understand the math behind how the bones interact with each other.

So I guess I have two questions.

1.Is my understanding of a "general" concept of a skeletal animation system correct?

2. How would one transform the child bone to act accordingly to what the parent has done? So for example, if you were to rotate bone1 45 degrees on the x-axis, how would you keep its child(bone2), attached at the joint, and move it accordingly? This is my biggest issue,
understanding the math behind it.

Thanks guys!


PARTNERS