M4573R

Members
  • Content count

    314
  • Joined

  • Last visited

Community Reputation

144 Neutral

About M4573R

  • Rank
    Member
  1. I troubled myself over #1 for a while too, then just ending up pushing components onto the back of a vector and doing linear look-ups. Like you said, one component will hold onto another component internally and will only do a look up on construction. Plus I'm never going to have many entities with more than a handful of components. As far as cleanup, when a component is destroyed, I immediately send a notification to anyone who cares so they can do whats needed to remove the reference. Then I can delete it right then and there.
  2. The very first thing that pops into my head is: Have you tried using an existing slerp and quaternion-to-matrix from a library you know works? It could be a good sanity check before trying anything else.
  3. [quote name='turch' timestamp='1328624807' post='4910502'] The methods described [url="http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.90%29.aspx"]here[/url] have always worked for me. I get a file and line number without having to make a new macro, and it counts the allocations so you can see which alloc numbers leak and then re-run the program and break on those allocs to see exactly what context they happen in. Of course that only works while your code remains deterministic, such as at startup. Some people don't get the line numbers and files for some reason, I never looked into why since it never happened to me. [/quote] You do not get file and line numbers when using 'new' unless you follow the method described here: [url="http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx"]http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx[/url] [code]#ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG[/code] My current solution uses an allocation hook, and walking the stack, which works globally without having to use abundant includes everywhere. The only downside is that it requires the hack of locally defining the memory block header in order to map deallocations to allocations.
  4. So I did some more research, and alloc hooks using the crt seems sufficient enough for what I'm doing. However documentation on it is awful. My google-fu is completely failing me. I can record allocs fine, but when I get frees, I only have a point and must somehow get at the _CrtMemBlockHeader which is not defined for my use. Resources I've found use something called "pHdr" to go from pointer to header, but I can't find a single piece of official documentation on it. Any thoughts? Edit: It appears people are redefining a matching _CrtMemBlockHeader locally that matches the one in dbgint.h, then manually grabbing the pointer to it by casting an allocation to it and subtracting 1. That feels completely gross. Why is there not a better way to do this? Why does the documention on the CRT not describe how to grab information from a free in your alloc hook? There is no other way to match a request ID of an allocation to a pointer otherwise. Yet another edit: Since I don't want to define the debug new everywhere so the crt can pickup and file and line numbers, is there a way I can hook the output and translate its output to symbols manually?
  5. Agreed, it doesn't sound like a great way to go. I wanted to use crt leak checking but I still have to redefine new for the file and line to show up, but it has the issue where I can't define it globally which is irritating.
  6. I can do that, I saw a resource describing that process and can find it again. Though I'll still need to replace new/delete to do it. I was also having a problem with an stl container calling my delete, but not my new. Is there a more manual way to replace new/delete that only I will use (like a NEW macro).
  7. I'm dusting off some old memory debugging code that overloads new and delete. I'd like to have this code in a separate library, but am not sure how to include my overloads elsewhere without having conflicts. If I try putting it in a pch for a project, I get all sorts of errors in crtdbg, xlocale, etc. I'd like to not have to include this in every source file. These are the overloads I'm using: [code]void * operator new(size_t size, const char * file, unsigned line) throw (std::bad_alloc); void * operator new(size_t size, const char * file, unsigned line, const std::nothrow_t&) throw (); void * operator new[](size_t size, const char * file, unsigned line) throw (std::bad_alloc); void * operator new[](size_t size, const char * file, unsigned line, const std::nothrow_t&) throw (); void operator delete(void * ptr) throw (); void operator delete(void * ptr, const std::nothrow_t&) throw (); void operator delete[](void * ptr) throw (); void operator delete[](void * ptr, const std::nothrow_t&) throw (); #define new new(__FILE__, __LINE__)[/code]
  8. General XNA Math Usage

    I'm looking for the exact same answer. The load/store is a huge hassle.
  9. *Sigh* I was missing the additional include directories in the final project the headers were getting included in. For instance, my application.h couldn't find graphics.h because main.cpp was including application and compiling it first without the proper include directories.
  10. [quote name='Hodgman' timestamp='1323140242' post='4890959'] Can you post up your actual directory structure / paths of all the relevant sources/headers/projects/solutions? Also, what do you mean by "It works for source files, but not header files"? [/quote] The additional include directories work when I include in .cpp files, but not .h files. Here is my folder tree: [code] +---Application | Actions.h | AppContext.h | Application.cpp | Application.h | Application.vcproj | MainMenu.cpp | MainMenu.h | Scene.h | SceneManager.cpp | SceneManager.h | Window.cpp | Window.h | +---Engine | Engine.ncb | Engine.sln | +---EntryPoint | EntryPoint.vcproj | main.cpp | +---Graphics | AssetManager.h | AssetManger.cpp | CameraComponent.h | ComponentEnum.cpp | ComponentEnum.h | Components.h | ComponentsInt.h | CullMethod.h | D3DAsset.cpp | D3DAsset.h | DrawableComponent.h | Forward.cpp | Forward.h | Graphics.cpp | Graphics.h | Graphics.vcproj | GraphicsLib.h | GraphicsWindow.h | Material.h | MaterialComponent.h | MeshComponent.cpp | MeshNode.h | Pch.cpp | Pch.h | Renderer.cpp | Renderer.h | RenderMethod.h | SimpleCull.cpp | Texture.cpp | Texture.h | TextureComponent.cpp | TextureComponent.h | TransformComponent.cpp | TransformComponent.h | +---Input | Input.cpp | Input.h | Input.vcproj | InputMessages.h | KeyMap.h | Keys.h | +---Math | GameMath.h | Math.vcproj | Vec2.h | Vec3.h | xnacollision.cpp | xnacollision.h | \---Universal Assert.h Component.cpp Component.h ComponentFactory.cpp ComponentFactory.h Entity.cpp Entity.h Handle.h Helpers.h NotifyDispatcher.h Singleton.h Timer.cpp Timer.h Universal.vcproj [/code] As an example, I can include Timer.h inside Application.cpp, but I cannot inside Application.h. Inside of Application.h I must use "..\Universal\Timer.h"
  11. [quote name='Hodgman' timestamp='1323070692' post='4890634'] Relative include paths inside source files are relative to the source file. Relative include paths in a project file are relative to the project file. In your case, is your project file in the same directory as your source file? [/quote] Indeed it is. The solution and each project with its source are in neighboring folders. So even if it was relative to the solution, project, or source, it should all use the same relative path.
  12. [quote name='Triangles-PCT' timestamp='1323058924' post='4890585'] Perhaps you need the trailing \ like this.. ..\boost\ or in your case ..\Folder\ [/quote] Tried that :/
  13. I can include headers inside other headers with relative paths such as "..\Folder\Header.h", but it does not work if I add to the project's additional include directories "..\Folder". It works for source files, but not header files.
  14. I was just curious what methods people are using to store per-instance data for scripts. The way I did it in the past was that each script component for an object would have a map of string->floats and string->string and I just queried them from lua. It seems like it wouldn't scale very well though. Although if you used variants in your code for object properties, then I could see this working so well that the performance hit would be worth it, and there wouldn't be separation between script / code object data. Just curious how other people are doing it.
  15. I tried a different file in the same situation, and for that one it did not find the file to include, so you must be right about it finding a different file. I had to add the additional include directories to my project to get it to work. Switching between quotes and angle brackets did not help. Why can VS not find a file if I include it in a project? Why should I have to also add include directories?