Jump to content

  • Log In with Google      Sign In   
  • Create Account

Waaayoff

Member Since 11 Sep 2009
Offline Last Active Apr 24 2016 11:35 AM

#5257531 Game Engine Editor

Posted by Waaayoff on 16 October 2015 - 11:26 AM

I use wxwidgets. I find it easy to use and it has a lot of functionality. 




#5248977 Finding Up and Right vectors from Look for view matrix?

Posted by Waaayoff on 26 August 2015 - 07:06 AM

What if I want to be able to set it upwards?




#5248967 Finding Up and Right vectors from Look for view matrix?

Posted by Waaayoff on 26 August 2015 - 06:29 AM

I want to be able to set the direction the camera is facing but I can't figure out how to determine the other vectors from the view direction.




#5245809 What is a wrapper? What is a Decorator?

Posted by Waaayoff on 11 August 2015 - 01:32 PM

A wrapper function or class is just a piece of code that envelopes existing code, while adding new functionality before (e.g. initialization) or after (e.g. clean up) the existing code. Example:

file* loadImageWrapper(string filename)
{
    if (!fileExists(filename))
         // Handle error

    result = loadImage(filename);   // Original function

    if (!result)
        // Handle error 
}

The wrapper could of course be more complex than that depending on the situation. It could also simply not have any new code added and just be used to set up a new name for the existing function.

 

 AFAIK, decorators are the same thing as wrappers.




#5244909 How to use D3DX11CreateShaderResourceViewFromFile to create a CPU readable te...

Posted by Waaayoff on 07 August 2015 - 02:02 AM


So I want to read one or multiple large textures, lock them, use the data on the CPU to get all mip levels in a chunk and create a default usage and bind flags texture for each chunk, then discard the large texture.

I have several special partitioning schemes that have their data saved on disk as a texture. I need to read that texture, process it, and then discard it.

 

Why do you need to create a GPU resource then? Just save your "large textures" as raw height values and read them directly from disk to CPU. That would make much more sense (and would be faster). 




#5243338 3d file format with skeletal animation and normal mapping

Posted by Waaayoff on 29 July 2015 - 01:55 AM

Well I had a look at collada and it was perfectly suited my purpose! Thanks guys. Writing the converter is also easier since it's basically xml. Big thanks!

 

I suggest using an existing converter such as Assimp instead if it suits your needs. It will save you a lot of time and headaches.




#5238646 Why use texture splatting?

Posted by Waaayoff on 06 July 2015 - 12:23 PM

Also, one thing I don't often see mentioned; you can splat down one more texture than you have splatting channels. ARGB is 4 channels, and allows 5 splatted textures. Instead of normalizing the four channels so they all add up to 1.0, you can take the difference between 1.0 and their sum, and use that as the implicit value of texture #5 (or #0, if you prefer).

 

Well technically you can have more if you implement the method described here. They use an alpha map that contains IDs of texture splats so for every pixel you can have any 2 textures and an alpha value to blend them.




#5150755 What's the best way to handle game objects and their assets in a statical...

Posted by Waaayoff on 01 May 2014 - 10:39 AM


* How to choose which class to make an instance of based on the object type name in the level layout file?

 

There are many ways to do this. First you should separate the graphical representation from the actual object. (i.e you could have four race car objects, but only one mesh that is used for all cars.) Your layout file will contain, among other things, the type of object and an identifier for the mesh(es) it uses.

 

Second you need to choose a paradigm to represent your objects, such as inheritance or Component Entity Systems. Simple inheritance would probably be best for now.

 

Now, when you load your files, you would create an object (naturally you would need if statements like you said but as things get more complicated you will look into more sophisticated patterns such as a factory method). Then you would request the mesh for this object by ID and load it if it wasn't loaded before.

 


* How to load and unload the graphics used by the objects in the layout?

 

Just like you request a mesh to be loaded, you request for it to be deleted. Mesh creation/deletion/requests can be handled by one or more classes. But for now a simple ResourceLoader class would suffice. This class would have for every mesh some kind of counter that counts how many objects are using that mesh. Every deletion request would decrement the counter until it's zero. Here you can either completely delete the mesh or keep it in cache. This depends on the type of game you're making.

 


* It's necessary for objects to find out about other objects of certain types for them to be able to interact.

 

No, they don't. Objects should NOT care about other objects. The game logic and game objects should be separated. For example, if you want to do collision between two objects, you would calculate whatever collision response you want in a different class, then tell each object to change their state or position accordingly. Direct communication between game objects should be minimal if not nonexistent.




#5142669 Proper exporting collada

Posted by Waaayoff on 27 March 2014 - 01:47 PM

I usually export to FBX from Blender (since its Collada exporter is crap), use FBX Converter to convert to Collada, then import using Assimp.




#5142666 Why are my two classes sharing variables? C++

Posted by Waaayoff on 27 March 2014 - 01:23 PM

Just curious. You set a lot of class variables as private. Any reason why you do that?

 

wat  




#5141467 Assimp Skeleton Bind Pose

Posted by Waaayoff on 23 March 2014 - 10:18 AM


Waaayoff, on 23 Mar 2014 - 10:51 AM, said:

// DO NOT FORGET TO TRANSPOSE when you load them
 
So I have to transpose the offset matrix to get the bind pose ?

 

No. From what i remember, this comment was there to remind me to transpose the offset matrix because of the difference between the matrix order between Assimp and DX. Try it with and without transposing and see which one is correct.

 

 

 



Waaayoff, on 23 Mar 2014 - 10:51 AM, said:

D3DXMATRIX final = pJoint->mAnimatedTransf * P;
 
Is 'P' the parent's transform matrix ?

 

Yes. This is the whole function. It will be called with the skeleton's Root bone and an identity matrix.

//=====================================================================================================
// Recursively calculate the joints' combined transformations
//=====================================================================================================
void AnimationController::CombineTransforms(Joint* pJoint, const D3DXMATRIX& P)
{
	  D3DXMATRIX final = pJoint->mAnimatedTransf  *  P;

	  mFinalTransforms.push_back( pJoint->mOffsetTransf * final );

	  for (unsigned i = 0; i < pJoint->mChildren.size(); i++)
	  {
			 CombineTransforms(pJoint->mChildren[i], final);
	  }

Where, like i mentioned above, pJoint->mAnimatedTransf should contain the local transformation if you want to get the bind pose.




#5141388 Assimp Skeleton Bind Pose

Posted by Waaayoff on 23 March 2014 - 03:51 AM

It's been a long time since i looked at my animation code but i found this comment:

 

"Turns out Assimp generates animations relative to the parent joint, NOT the joint itself. So i don't have to multiply the animation transformation by the local transformation. Which i only use if there is no animation for a bone.."

 

Along with this code: (It's used for animation rather than getting the bind pose but since the bind pose is usually the first frame of animation, it should be similar to what you're looking for)

// pJoint->mAnimatedTransf is initialized with Assimp's local transform (which you can find like this: g_Scene->mRootNode->FindNode(bone_name)->mTransformation)
	// Then it can be replaced per frame by an interpolated animation transformation for every bone that has an animation
	// pJoint->mOffsetTransf you can find in an aiBone struct
	// DO NOT FORGET TO TRANSPOSE when you load them

	D3DXMATRIX final = pJoint->mAnimatedTransf  *  P;

 	//mFinalTransforms contains the matrices that will be sent to the shader
	mFinalTransforms.push_back( pJoint->mOffsetTransf * final );

From Assimp's documentation:  "Its [bone's] offset matrix declares the transformation needed to transform from mesh space to the local space of this bone."

 

i.e. it's the inverse bind pose.




#5140342 Your one stop shop for the cause of all coding horrors

Posted by Waaayoff on 19 March 2014 - 10:16 AM

I enjoyed this - thanks for sharing.
 
Also:

// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass
The history of software development in a nutshell.

 

 

When I was just programming for fun, i saw that thread and laughed. Oh how i laughed. Now that i'm getting paid to maintain someone else's code... :(




#5111232 Yiddish indentation

Posted by Waaayoff on 22 November 2013 - 01:26 AM

*gosh*. I really feel embarrassed now about my ignorance of the complexity, so thanks for that link.
 
Still would be glad to hear some answers to my question: Nobody had any troubles learning programming because of clashing reading directions ?


My first language is Arabic which is written from right to left. I didn't have any problems because I also know English, which I'm pretty sure is the case for all programmers...

And this indentation makes my eyes bleed :)


#5104614 Globals usage in tutorials and elsewhere.

Posted by Waaayoff on 26 October 2013 - 12:14 PM

I tend to use both Globals and Local Variables.  I use Globals for mundane task which may be used in several Functions through out the coding.

For Example :  int x,y;  // Loop Counters  These I declare up front instead of declaring them in Each function I would use a Counter.

 

 

Oh the humanity






PARTNERS