Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Dec 2012
Offline Last Active Apr 22 2014 01:18 AM

#5045503 Class instances gone wrong!

Posted by on 21 March 2013 - 10:52 PM

template void safe_delete(T* x) { delete x; x = NULL; }


This should probably be safe_delete(T*& x) as otherwise you're only assigning the local variable to NULL.

#5020813 Advanced Render Queue API

Posted by on 12 January 2013 - 01:38 PM

Thanks for the reply, Hodgman.  Memcpy does seem to work on non-POD types in this case.  I'm interested in the alternate design you suggested using composition rather than inheritance.  That looks like it work quite well for one level of inheritance, but I'm not sure about how you would extend this to multiple levels of inheritance.  For this renderer design, I think you might need two levels of inheritance -- you mentioned that State inherits from Command, and then, in my understanding, you have multiple render-state structs derived from State.  Would you just do something like this?

struct Command {
   u8 id;

struct State {
    Command baseClass;
    // other members...

struct BindShader {
    State baseClass;
    Shader* shader;

#5019767 Advanced Render Queue API

Posted by on 09 January 2013 - 11:02 PM

I get around the undefined behaviour with inheritance...


But if you use inheritance, don't the structs become non-POD types?  That might create more undefined behavior to deal with -- for example, I was thinking of using memcmp for detecting redundant state-changes in the RenderGroup class, but that would only work if the structs were POD.

#5018717 Best Language for Cross-Platform Content Pipeline

Posted by on 07 January 2013 - 02:29 PM

I'd like to make a content pipeline for some of my games/engines/etc I'm working on, and I'm not quite sure what would be the best language to use.  I'm using C++ for the actual runtime, but this seems very unproductive for tools.  I've seen C# recommended several times for Windows-only content pipelines, but I'd like to know if there's anything more cross-platform.


Here are some features that an ideal language would provide:

  • It also should provide some abstraction of OS-specific functionality such as directory iteration, etc.  It should also be easy to use high-level features such as regular expressions and other text-manipulation techniques.
  • Integrating this language with Lua should be simple, as I want to use Lua as a data-description language for several resource types.
  • Calling external processes shouldn't be too hard -- for example, I might want to use the Cg toolkit's cgc program to compile shaders.

I suppose C++ could work if I used heaps of boost libraries -- this does seem a bit cumbersome though, and I imagine it would cause a large hit on compile times.


Anyone have any suggestions for a good language to use?

#5015630 Advanced Render Queue API

Posted by on 29 December 2012 - 09:57 PM

Hodgman, wouldn't this violate the strict aliasing rule when you cast a Command reference to a Foo or Bar reference, or vice versa?