Jump to content

  • Log In with Google      Sign In   
  • Create Account


TheUnnamable

Member Since 20 Aug 2009
Offline Last Active Mar 23 2014 07:00 AM
-----

Posts I've Made

In Topic: How to make spread when shooting? and rotate bullets correctly?

06 March 2014 - 01:02 PM

I think the idea with the normalized vector is to spawn points around that vector in an area, normalize it again and you have your direction vector for the bullet. And that will give constant spread.

A simplified way of doing the same thing is to store the direction you're shooting in, add some random offset and point the bullet in that direction.


In Topic: Std vector, sorting and/or filling

15 February 2014 - 12:32 PM

Are you sure you certainly need a vector?

If your elements are unique, you could use an std::set or std::map, which both offer sorting, you'd only have to roll your own compare-function.


In Topic: will mingw optymize ...

05 February 2014 - 10:20 AM

passing with & * is dirtier to read test etc
I don't see how using references would be dirtier.
struct float3 { float x,y,z; };
 
float3 cross(const float3& a, const float3& b)
{
   float3 out;
 
   out.x = a.y * b.z - a.z * b.y;
   out.y = a.z * b.x - a.x * b.z;
   out.z = a.x * b.y - a.y * b.x;
 
   return out;
}

This will eliminate two ( unnecessary ) copies, and the function definition also tells you that the two input parameters are read-only, so you can depend on their values staying the same after the function call. Notice how the function body didn't change at all. You'd use the function the same way you did before, too.


In Topic: Texture format for heightmap brushes

28 January 2014 - 07:35 AM


That swizzling is a texture attribute. Samplers in shader scripts can swizzle by their own.



As mark has mentioned above, the only speciality of the alpha channel is that it is set to 1.0 (instead of 0.0) if not present in a texture. Hence there is no reason why not to use the green channel values as an alpha.
Seems like shaders are inevitable then, so I'll go with that. Thanks :)

In Topic: Texture format for heightmap brushes

25 January 2014 - 04:48 PM

You can imagine brushes like stamps. A heightmap with an alpha map, for example a hill brush, which has a heightmap of a hill stored, with alpha fading out on the sides. Take a few variations and you can draw a mountain with brushes quite fast utilizing the GPU.

GL_R16 and GL_RG16 are indeed much better choices. Firstly, I use symbolic types, because the precision might vary ( if it's supported use floats, if not use uints, if not use ushorts, etc. ). Secondly, GL_R is absolutely fine for heightmaps. However it lacks alpha. GL_RG has two channels, which is great since it's faster and actually supported compared to GL_LUMINANCE_ALPHA, but GL_RG doesn't have an alpha channel.

 

Thanks for your input smile.png Sorry for being stubborn, but I'm sticking with DX9-level stuff.

 

Edit: I'm actually thinking about using two textures, one for height one for alpha. Architecturally it wouldn't complicate things much. That way I could stick with GL_R, and really really hope that the draw count won't be an issue in this case. Still waiting for any inputs tho', there's always a possibility that someone smarter can come up with more elegant stuff :D


PARTNERS