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!


Member Since 30 Aug 2010
Offline Last Active Jun 26 2014 11:25 AM

Posts I've Made

In Topic: Tips for Programming a GUI

28 April 2014 - 09:29 PM

One note unless GUIWindow is this I recommend a UIPanel class. This is pretty much just a group of components that has a size and can organize children relative to its position. It lets you anchor points and you will need a margin / anchor property to make sure everything lines up unless you are only wanting to support 1 resolution. Another convenient figure is if you allow it to clip children. Then you can create scroll views. Most gui utilities support panels, grids, and other organizational items but you can get by with just a panel to be honest. Also by supporting children to organizational objects you can build together different parts to make more complicated components.  Also when you create your event system you can search through your items in a tree structure rather then a linear list. Also you NEED events / callbacks. If you are in c++ use FastDelegate as a base for your delegate system and build an event class. Most other languages have some sort of support for that otherwise.


Common components I use.

1. Textbox

2. Texture Button

3. Label

4. Progress Bar / Slider (these components internally will be very similar)

5. Scrollview

In Topic: Depth Buffer Issue

21 April 2012 - 06:07 PM

Found out the issue. I changed this


: /

In Topic: How can i translate mesh with vector?

21 April 2012 - 05:58 PM

I have already traslate a mesh with the function D3DXMatrixTranslation in a precise position of the 3D space. But how can i do to move the mesh in direction with a vector?
Sorry for my english Posted Image .

Easiest way is to keep a hold of the position you want is in a vector than when it comes time to actually do the transformation transform it into a matrix.

so in your game logic you can simply do position += velocity or something like that, but when your it comes time to render just do
D3DXMatrixTranslation and multiply the mesh by the matrix.

In Topic: Design: Object transformation

18 April 2012 - 03:16 PM

I don't understand what you use those "vectors" for or why they have a last coordinate 1 instead of 0... I am trying to fit what you are saying into the relevant math I know, and it's not working.

Model is centered at <0,0,0,1> 4-D vector or the origin.

So x-axis is <1,0,0,1> and z-axis is <0,0,1,1,>. We arbitrarily define a given vector as "forward" or "backward" or "up" based on which way we preferred. The result is that if you want the "forward" of a model you can just take the "forward" vector and multiply it by the world matrix of a model and get the direction it's facing.

Really 99% of the time we wanted rotation information from the model it was which way is "forward" or "up" or "down" or "left" so we would take the vector denoting the default forward and multiply it by the models world matrix to get which way it was facing. So before model->world transformation we know that forward is the same as the "forward" vector constant. So which way it is facing now is "forward" * WorldMatrix.

Object transformations were simply handled by augmenting this matrix. So you want to rotate it along the Zaxis? Call matrix.RotateZ(float angle) and rotate the object. Want to Translate it? Call matrix.Translate(x,y,z). Was pretty easy overall.

This one matrix inherently had all the information we needed readily available so we just used that.

[ stuff stuff stuff 0]
[stuff stuff stuff 0]
[stuff stuff stuff 0]
[x-pos, y-pos, z-pos 1]

The only objects we needed that needed to know exact angles was the camera which was handled with a Quaternion.

i really only use quaternion's interpolating rotation based animations, for character movement and whatnot matrices are easier imo. . Want the object to slowly move some direction? Get the vector pointing to the object and slerp all day.

In Topic: Design: Object transformation

18 April 2012 - 12:20 AM

Since your objects are stored at the origin I recently worked with a group that did it a bit differently.

You define a constant forward,right,left,up vectors up = <0,1,0,1> down = <0,-1,0,1> forward = <0,0,1,1> right = <1,0,0,1> left = <-1,0,0,1> To get your "forward" or "down" vector it was just a single matrix multiplication away. Just make sure your "forward" of your model is facing <0,0,1,1> and the rest is easy.

There was than 1 matrix for local rotations and scaling, 1 World Matrix where the bottom 4 floats were the position, 1 vector for recording scale so you can use an absolute scale with models.

Was a bit weird but was pretty easy to be honest.