Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Mar 2012
Offline Last Active Jun 15 2014 02:58 PM

#5073023 Static Initialization and Ctors

Posted by on 26 June 2013 - 12:22 PM

Are you creating a SceneElement object, or an object that in turn creates a SceneElement object, statically anywhere? In that case, that object may be constructed before the map constructors, and thus the SceneElement constructor is accessing a not-yet-constructed map object.


For details: http://www.parashift.com/c++-faq/static-init-order.html and http://www.parashift.com/c++-faq/static-init-order-on-first-use.html.

#4940240 Voxel traversal problem

Posted by on 14 May 2012 - 05:46 PM

// There's no problem here!
ray.Position.X += 0.5f;
ray.Position.Y += 0.5f;
ray.Position.Z += 0.5f;
int x = (int)ray.Position.X;
int y = (int)ray.Position.Y;
int z = (int)ray.Position.Z;

Actually...there is a problem there.

Try this: don't modify the ray position and use floor instead of casting to an int.