Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1152 Excellent

About BloodyEpi

  • Rank

Personal Information

  • Interests
  1. A few notes: - no need for "using namespace std", you are writing it anyway(which is a good thing) - virtual destructor in System - At some point you will want specify the order in which the systems are updated, currently you can control this only by the order in which they are added - Its hard to give advice without seeing how you will be handling the components
  2. I'd say both code snippets you provided should do the same eventually.   newLayout will be released at least twice, once with the direct call and once after it is destructed/overwritten in the vector.   How about GetInputLayout() simply keeps and returns a ComPtr itself? This way its also clear who should perform the cleaning.
  3. Why not just have an online compiler with basic IDE to try out some stuff? Either people get hooked and are willing to install some overhead needed to get started or they just close the browser tab.   While I was reading my last C++ book and had only a not so fast tablet available, this was the perfect solution to try out some snippets.
  4. BloodyEpi

    Marching cubes on GPU (DirectX)

    http://web.archive.org/web/20020802074137/http://astronomy.swin.edu.au/~pbourke/modelling/polygonise/   This has a very good explanation and simple code (not dX specific though).
  5. If you use universal references(which sounds like what you need) you can also add an enable_if to limit the parameter type instead of a static_assert.
  6. - Getting a reference or pointer into a map which might just delete that element sounds like a bad idea - Also keeping pointers to components means that every time a system moves through a components vector, you'll have to dereference every single component (also true if getting a single component from that vector) - If you really need to use pointers and pass them around, use smart pointers, otherwise someone is going to delete a component and you'll have a lot of fun debugging that   Since you already have a vector for every type of component why not just have multiple vectors of type std::vector<ComponentX> and some template magic to have multiple of these within the same pool? After that a loop iterates over one of these vectors and calls some system with a reference to every component.   Theres also quite some ECS implementations available to look at or use.
  7.   Actually, m_ for members and g_ for globals helps quite a bit while reading a lot of unknown code. For example, when doing something with threading and you see that a member is used, but can't find a mutex anywhere around.
  8. This seems like something easily done using a debugger.   Also, it seems like parents can have only one child, but multiple childs can have the same parent?
  9. Did you check the headerfile of RakNet::SocketDescriptor? The member is in there?   Maybe its just a weird follow up error from something else, like missing include guards etc.?
  10. BloodyEpi

    Writing to a buffer

    So, I guess putting my data into an RWStructuredBuffer and letting the CS do its work sounds good.   The internet says that, afterwards, I can use a UAV to directly stream a new mesh into a VertexBuffer using the CS and the previously created data. (Please correct me if Im wrong or this can be done somehow more effective.)   Thanks!
  11. Hi,   I came across this idea for Surface Nets (http://www.merl.com/publications/docs/TR99-24.pdf) and I was wondering if it would be a good idea to implement it using D3D11.   The algorithm would need to iterate over a net multiple times, however since it needs to know the coordinates of every voxels (up to) 6 neighbors for a calculation, a simple vertex buffer probably wouldn't do it.   So, is there a way to let a shader write into some kind of hlsl buffer? I've been looking for an answer but couldn't find much, I have been doing some stuff with the stream output, but I don't think generating a new mesh for every iteration is a good idea.   Or would this be something better run on the CPU, since there is probably some branching going on depending on how many neighbors a voxel has.   Thanks in advance
  12. Have you tried debugging it?   How sure are you that frameDelta is 1 / oldTime doesn't change? It sounds like only one of these can be true.
  13. BloodyEpi

    Passing object by value gives weird result

    Got it to work void ConstructEntity(const Entity entity, void* memory) needs to get a reference void ConstructEntity(const Entity& entity, void* memory)
  14. Hi, Im having some trouble calling an as method and passing an object per value.   This is my as code: class Object { Object() { } void OnUpdate(Entity entity, int deltaMs) { Print("Hello world\n" + deltaMs); } }; If I remove "Entity entity" (and other corresponding code) everything works fine. If I add it back in I get a weird error (see below), so my guess is that it has something to do with the entity class.   Here is the code I register it with: void ConstructEntityDefault(void* memory) { new (memory) Entity(); } void ConstructEntity(const Entity entity, void* memory) { new (memory) Entity(entity); } void DestructEntity(void* memory) { ((Entity*)memory)->~Entity(); } //later on r = m_engine->RegisterObjectType("Entity", sizeof(Entity), asOBJ_VALUE | asOBJ_APP_CLASS_CD ); assert( r >= 0 ); r = m_engine->RegisterObjectBehaviour("Entity", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructEntityDefault), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = m_engine->RegisterObjectBehaviour("Entity", asBEHAVE_CONSTRUCT, "void f(const Entity &in)", asFUNCTION(ConstructEntity), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = m_engine->RegisterObjectBehaviour("Entity", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructEntity), asCALL_CDECL_OBJLAST); assert( r >= 0 ); And here is the code to call it: void CallFunction(asIScriptFunction* func, void* object, Entity entity, int delta) { assert(func); int r = m_ctx->Prepare(func); assert( r >= 0 ); if(object != nullptr) { r = m_ctx->SetObject(object); assert( r >= 0 ); } r = m_ctx->SetArgObject(0, &entity); assert(r); r = m_ctx->SetArgDWord(1, delta); assert(r);  If I call the first SetArgObject method, m_ctx (asIScriptContext) becomes 0x0. More precisely, it happens when calling the copy constructor in ConstructEntity(...)   The constructor is defined like this: Entity(const Entity &other) = default; If you need any other information let me know.   Thanks in advance Epi
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!