Jump to content
  • Advertisement

kitman20022002

Member
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

201 Neutral

About kitman20022002

  • Rank
    Member
  1. kitman20022002

    How to avoid Singletons/global variables

     so if I'm correct I need to add a abstract class for the Texture.     But then it still does not make sense. these are the things I understand from this pattern 1.If we create a Ioc container class is will be easily for us to see what things can be init first, instead of digging into different classes and see what they are init.   2.While I'm include things my texture class does not need "#include<resourceLoader.h>" , so later on I can put this texture class into another other project it will work   But there still some things I don't understand 1. Of my understanding, more code == more bugs + more test case + use more time to read the code    2. If I wanted to include my resoruceLoader and texture class into other project I would need to copy 4 files , but then using singleton I just need to copy 2 files, which means I need to remember more filenames, seems not worth.  3. Is IResourceLoader == Ioc container ?  4. Still don't really understand about the interface types, because if I'm 100% sure I'm not going to delete or rename my texture class, why do I still need a abstract class for the texture, if not what can happen ?   5.What should I call/name my abstract class ? 
  2. kitman20022002

    How to avoid Singletons/global variables

        After looking a lot dependency injection example ,there's a lot of questions in my head, but let's talk about the first one, so first question I want to know is, what I know Dependency Injected actually looks like:   class Texture { public: Texture(){ m_name = ""; m_ID = -1; } int m_ID; string m_name; } class ResourcesLoader { public: ResourcesLoader() { m_textures = new Map<string, Texture*>(); } void CreateTexture(Texture *a_texture , string a_name) { //not sure am I putting the code in the right or should I put it in IResourcesLoader bool haveTexture = false; for(int i =0 ; i<m_textures ; i++) { if(m_textures[i].name == a_name) { a_texture->m_ID = m_textures[i].ID; haveTexture = true; } } if(!haveTexture) { a_texture->m_ID = OPENGL_genTexture(a_name); } a_texture->m_name = a_name; m_textures.Add(a_name , texture); } private: //not sure should I put it here or not Map<string, Texture*> m_textures; } class IResourcesLoader { public: ResourcesLoader* m_resLoader; Texture* m_texture1; IResourcesLoader() { m_resLoader = new ResourcesLoader(); } Texture& CreateTexture(string a_name) { m_texture1 = new Texture(); m_resLoader->CreateTexture(m_texture1, a_name); return m_texture1; } private: //same : not sure should I put it here or not Map<string, Texture*> m_textures; } is that correct?  and this is one of the link I was looking 
  3. kitman20022002

    Difference between Framework and Engine

    lol, of course I will show a working game. but finding a programming job in Australia is really hard, which means : Get a job in AUS = Know how to make a game and also release on Goolge Play/Ios + make something similar to UE or Unity to show I understand the theory and know how to apply to theory in to code. (and because I say similar and not exactly so that's why I need to find out the definition which has strong statement to prove it is a Engine/Framework/API or something else). which also to me means they are trying to hire a senior programmer but paying junior salary.  
  4. Heard it it bad to use but not much example tell you how to replace/avoid to it , considering the following case  //making things public so it's just faster for us to understand the example //Texture.h class Texture { public: Texture(string a_name){ m_name = a_name; m_ID = TextureManager.GenTexture(a_name); } string m_name; int m_ID; }; //Texture Manager.h class TextureManager { public: //this store the name of the texture and the ID of the texture static Map<string, int> m_textures; static int GenTexture(string a_name){ //assume the following code works, you guys get the meaning for(int i =0 ; i<m_textures ; i++) { if(m_textures[i].name == a_name) { return m_textures[i].ID; } } int id = OPENGL_genTexture(a_name); m_textures.Add(a_name , id); return id; } } There's only know one way to not use slot of not use global variable , but it does not make sense to me  //Texture.h class Texture { public: Texture(string a_name){ m_name = a_name; m_ID = TextureManager.GenTexture(a_name); } string m_name; int m_ID; private: static Map<string, int> m_textures; static int GenTexture(string a_name){ for(int i =0 ; i<m_textures ; i++) { if(m_textures[i].name == a_name) { return m_textures[i].ID; } } int id = OPENGL_genTexture(a_name); m_textures.Add(a_name , id); return id ; } }; so it there anyone can give me recommendation what to do about it?  thanks  
  5. kitman20022002

    Difference between Framework and Engine

    OK. just have to accept it for now    thanks guys I just just have to accepted it ,but one more thing, Hodgman you said "A framework is usually just libraries of code, but not always" so in what case its not would you mind to give me a example?  
  6. kitman20022002

    Difference between Framework and Engine

    I wish as well, but two main reason 1. communication wise, for example: When i was building a "engine" and show my teacher he says it's a "framework" not a "engine",but then I can't prove is he right or wrong.  2. Job interviews. when i'm interviewing, I'll wanted to show my "engine/framework", and when I say it is a engine while they think it's just a framework, They think you are unprofessional. (this happens when there almost two person have the same skills,and trying to decide who they need, at that point every single words matters) 
  7. Done research but definition is too board for me , from what I research the different between engine and framework Engine :  1.An engine allows you to have a list of entities, each with a position on the map 2.An "engine" is a self-contained,externally-controllable, piece of code that encapsulates powerful logic designed to perform a specific type of work, instruct it to perform some complex, abstract task, and it handles the specifics in a relatively efficient manner without further external guidance. 3.A  engine implements all of the components defined in the framework… or at least all of the components that the game engine developer feels is required in order to implement his game engine. 4.Engines are full features toolsets that actually manage your program flow. They handle core logic and implementation details and you act on top of that.   FrameWork:  1.A framework is a collection of (usually) lower level libraries and helper stuff that you can use to do whatever the hell you want 2.A "framework" is a "foundation" or "support structure" around which you build your actual application 3.A framework is mostly a bunch of component interfaces, but it does not implement those components. 4.Frameworks are toolsets that provide you with an API to accomplish tasks, however they do not run or control you program flow.     For example 1 : I can say PhysX helps to accomplish physics task , but because physX also has a update function , which control the flow of the physics, so how do you I know is PhysX a engine or a framework (I know on the internet it says it's a engine, just don't know why)? or maybe is there any function or variables I can look at so I can determine it is engine or a framework this we be the best.   For example 2 : when building a rendering class, I have a update and draw functions and also some setTexture , unbindTexture  , clearScreen and getOpenGLVersion functions, like this video  , so the update,draw and clearScreen is controlling the flow so I say it is a engine, but however settexture , unbindTexture, and getOpenGLVersion are support structure around my actual application which they don't control my program flow, so in this case how would I know is it a engine or a framework?   Thanks.
  8. Still didn't work,and by the way tempCam[2] means column2, so tempCam[4], tempCam[5], tempCam[6] will give me column4 , 5, 6 which does not exists, but I forgot I can draw line to help me debug it so the ANSWER is I find out was: tempCam[2].y *= -1.0f; tempCam[3].x *= -1.0f; tempCam[3].z *= -1.0f;  
  9. tempCam = inverse(m_viewMatrix); I assuming you mean this tempCam[1].y *= -1; , am I'm correct? I try this does not work    and also I try these   tempCam[2] = glm::reflect(tempView[2] , glm::vec4(1,0,0,1)); tempCam[2].w = 0.0f;   and also changing the fg shader code to     vec4 tmp = vec4(1.0 / pos.w);      vec4 projCoord = pos * tmp;      projCoord += vec4(1.0);      projCoord *= vec4(0.5);   vec4 reflectColor =texture(reflectionTexture , projCoord.xy);     and   tempCam [0].y *= -1;  tempCam [1].y *= -1;   tempCam [2].y *= -1;     and    tempCam[2] = glm::reflect(tempCam[2] , glm::vec4(1,0,0,1)); tempCam[2].w = 0.0f; tempCam[1].y *= -1;   glm::mat4 tempView = inverse(tempCam); drawScene(m_projection , inverse(tempCam ));   but does not work as well?   and also not using glRotate at all becasue my camera is handle by  Utility::freeMovement( m_cameraMatrix, a_deltaTime, static_cast<float>(m_cameraSpeed));
  10. How can I inverse the pitch if I only have the viewmatrix in OpenGL, as describe from this video from 11:19 to 12:19 thanks
  11.  I'm trying to parent a static box to it's object in PhysX by doing this glm::mat4 M = parentMat * glm::translate(a_position)* glm::yawPitchRoll(a_rotation.x,a_rotation.y ,a_rotation.z) * glm::scale(a_scale); m_object->setGlobalPose((PxTransform)m); however when I put the * glm::scale(a_scale) into the calculation it does not rotate anymore , does any one know how to solve it thanks?  I also try this  PxQuat Pxq = m_object->getGlobalPose().q; Pxq.rotate(PxVec3(a_rotation.x,a_rotation.y ,a_rotation.z)); m_object->getGlobalPose().q = Pxq; thanks
  12.  hi does any one know in PhysX what is the difference between PxCreateDynamic and m_physics->createRigidDynamic  , thanks? no doc appear to help me at all to explain what the difference it would be great to tell me will I can find that reference talking about the difference  
  13. kitman20022002

    How can I get the roatation in PhysX in opengl

    Im making the heading indicator which need the rotation from the helicopter ,and also the second method you told me it seems the maximum is only 6.18 not 6.28 for some reason that i dont understand
  14. kitman20022002

    How can I get the roatation in PhysX in opengl

    Just curious how can I get the rotation from the first method ? becasue on the internet seems mixed up a lot of stuff which is not openGL , it will be great it you can point me to the right direction , thanks     
  • 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!