Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

WarAmp

Member Since 06 Sep 2000
Offline Last Active May 17 2013 05:30 PM
-----

#4974880 Rectangle

Posted by WarAmp on 30 August 2012 - 01:00 PM

You will need to give us more than just your drawing code if you want us to help with a collision issue :)

It's likely that you are only testing ballvec.X/Y in your collision routine rather than the whole Rectangle, show us how you are determining the collision and 'bounce' and we can help you further :)


#4971531 What do I do with this?

Posted by WarAmp on 20 August 2012 - 10:41 AM

struct MyVertex
{
float x, y, z;  // Vertex
float nx, ny, nz; // Normal
float u, v;   // Texcoords
float a, r, g, b; // Color
float padding[4];
};


My openGL is a bit rusty, but I believe you want the value passed into the gl*Pointer() functions to actually point to the part of the struct that is relevant.
ie:
glNormalPointer(  GL_FLOAT, sizeof(MyVertex), &(*RenderListIT)->RenderMesh->VertexData.nx  );
glTexCoordPointer( 2, GL_FLOAT, sizeof(MyVertex), &(*RenderListIT)->RenderMesh->VertexData.u  );
glColorPointer(  3, GL_FLOAT, sizeof(MyVertex), &(*RenderListIT)->RenderMesh->VertexData.a  );
//etc....



#4940727 heading to position transform angle in C++

Posted by WarAmp on 16 May 2012 - 12:40 PM

If you are just trying to transform [0, 360] to [180, -180] then just:

newAngle = 180 - angle;

But what would really help us help you is some context. We can sort of see that you are having a problem with OpenAL, but other than just saying 'Not hearable at certain angles' we have no idea what you are doing vs. what the result is you are trying to achieve. Maybe even draw us some pictures to illustrate the problem?

Spend some time explaining the situation and we can spend more time trying to help. The more information you give us, the more we have to work with.


#4932588 Camera position in spotlight cone

Posted by WarAmp on 18 April 2012 - 03:15 PM

By 'radius for cap' I assume you mean the width of the light at the maximum range?
If so, the angle of the cone is simply given by our old nemesis, Trigonometry.

Tan(angle) = Opposite / Adjacent. In our case, that translates to Tan(angle) = CapRadius/Range

So to get our cosAngle, we do
float angle = atan(Spotlight.CapRadius / Spotlight.Range);
Spotlight.cosAngle = cos(angle);

I recommend just calculating that value once for each spotlight and storing it.


#4932555 Camera position in spotlight cone

Posted by WarAmp on 18 April 2012 - 02:09 PM

First, compute the distance from the camera to the spotlight. If this distance is greater than the range of the spotlight, then you are not in the cone.

Second, take that Vector that you used for the distance, and dot it with the facing vector of the spotlight. If that value is LESS than the cosine of the angle of the cone, you are OUTSIDE the cone. Else you are in.

bool IsCameraInSpotlightCone
{
	 Vector toCamera = Camera.Position - Spotlight.Position;
	 float dist = toCamera.Length();
	 if (dist > Spotlight.Range)
	 {
		  return false;
	 }
	 toCamera /= dist; 	
	 float cosAngle = dot(toCamera, Spotlight.Direction);
	 if (cosAngle < Spotlight.cosAngle)
	 {
		  return false;
	 }
	 return true;
}



#4865279 Atmospheric Scattering - Out-scattering integral solution?

Posted by WarAmp on 23 September 2011 - 02:09 PM

I'm not sure if this should be here or in the Math & Physics forum, if the mods want to move it, I won't complain. :)

I think I may have solved the Out-scattering integral as given in the GPU-Gems 2 article on atmospheric scattering.

I've written a solution and explanation on my crappy blog.

I would love it if some of you fine folks could go over my solution for me and let me know if I'm right, and perhaps even figure out how to apply it to solving the full In-scattering integral as well.

Thanks!


PARTNERS