Jump to content
  • Advertisement

Azzazelus

Member
  • Content count

    87
  • Joined

  • Last visited

Community Reputation

385 Neutral

About Azzazelus

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming
  1. Azzazelus

    Java begginer question

    Hello. I'm trying to make an ArayList with data that includes when the user logged in and logged out and save everything in a file like the date and the total time and so on. The problem is that I get stuck on a simple issue. I have this class: public class DayTimeFrame { int id; public DayTimeFrame() { FromHour = new ArrayList<Integer>(); ToHour= new ArrayList<Integer>(); FromMinute= new ArrayList<Integer>(); ToMinute= new ArrayList<Integer>(); } public void AddFromHour(int hour) { FromHour.add(hour); } public void AddFromMinute(int minute) { FromMinute.add(minute); } public void AddToHour(int hour) { ToHour.add(hour); } public void AddToMinute(int minute) { ToMinute.add(minute); } public ArrayList<Integer> FromHour; public ArrayList<Integer> ToHour; public ArrayList<Integer> FromMinute; public ArrayList<Integer> ToMinute;} And with that structure I want to make another Array that contains the element for all days in a month. So day 1 is a DayTimeFrame object that can contain more Integer elements like FromHour, To Hour and so on. If the user loggs 100 times in day 5 the element in the ArrayList that us the 5th one contains the DayTimeFrame that contaons 100 FromHour and ToHour elements. The thing is that when I want to modify the elements for conviencence I first fill the ArrayList<DayTimeFrame> dayTimeFrame = new ArrayList<DayTimeFrame>(); for(int i=0;i<=31;i++) { dayTimeFrame.add(emptyFrame); } [code] And when the user updates a day I just modify like this: [code]dayTimeFrame.get(1).AddFromMinute(11);dayTimeFrame.get(5).AddFromMinute(22);dayTimeFrame.get(7).AddFromMinute(33);dayTimeFrame.get(0).id=8; The problem is that even tho I specifically select only 1,5 and 7 and 0 index elements ALL THE ELEMENTS in the array change. Its like the objects share the same ArrayList<Integer>. I dont understand why. I come from C++ and I know if I declare an object inside another one it gets local to that object. Why the get function modifies all the elements ? Or is the problem with the members of the class and its another way to declare them?
  2. Azzazelus

    DX12 Fences in Dx12

    Hello. I'm learning DirectX 12 API and I dont understand some things regarding Fences. The GPU can signal a fence while working on a Command List and then continues the command list or the Fence is signaled only between command lists in the List Queue ?
  3. Azzazelus

    Cache misses and VTune

    Why not profile for loops ? If I iterate the first element of the data shouldn't the cache line be loaded with the data next to it  and for the next element should be a cache hit ? And also why Visual Studio should change my code ? Arent the random number generated at runtime? 
  4. Azzazelus

    Cache misses and VTune

    Hello. I've started using VTune and read about cache coherent data. Not I'm trying to uderstand VTune how it works by making some simple programs that will violate the rules of cache coherent data.   For example:     int _tmain(int argc, wchar_t* argv[]) {     int numbers = 500000;     struct object { float matrix[16]; float matrix2[16]; float matrix3[16]; float matrix4[16]; float matrix5[16]; float matrix6[16]; float matrix7[16]; float matrix8[16];         float position[3]; float uv[2];     };         object *vars =  new object[numbers]; object *vars2 = new object[numbers]; object *vars3 = new object[numbers]; object *vars4 = new object[numbers]; object *vars5 = new object[numbers];             float c; for (int i = 0; i < numbers; i++) {   switch (rand() % 10) { case(0): c = vars[rand() % numbers].position[rand() % 15]; c = vars2[rand() % numbers].position[rand() % 15]; c = vars3[rand() % numbers].position[rand() % 15]; c = vars4[rand() % numbers].position[rand() % 15]; c = vars5[rand() % numbers].position[rand() % 15]; break;   case(1):   c = vars[rand() % numbers].matrix[rand() % 15]; c = vars2[rand() % numbers].matrix[rand() % 15]; c = vars3[rand() % numbers].matrix[rand() % 15]; c = vars4[rand() % numbers].matrix[rand() % 15]; c = vars5[rand() % numbers].matrix[rand() % 15]; break;     case(2) :   c = vars[rand() % numbers].matrix2[rand() % 15]; c = vars2[rand() % numbers].matrix2[rand() % 15]; c = vars3[rand() % numbers].matrix2[rand() % 15]; c = vars4[rand() % numbers].matrix2[rand() % 15]; c = vars5[rand() % numbers].matrix2[rand() % 15]; break;       case(3) :   c = vars[rand() % numbers].matrix3[rand() % 15]; c = vars2[rand() % numbers].matrix3[rand() % 15]; c = vars3[rand() % numbers].matrix3[rand() % 15]; c = vars4[rand() % numbers].matrix3[rand() % 15]; c = vars5[rand() % numbers].matrix3[rand() % 15]; break;     case(4) :   c = vars[rand() % numbers].matrix4[rand() % 15]; c = vars2[rand() % numbers].matrix4[rand() % 15]; c = vars3[rand() % numbers].matrix4[rand() % 15]; c = vars4[rand() % numbers].matrix4[rand() % 15]; c = vars5[rand() % numbers].matrix4[rand() % 15]; break;   case(5) :   c = vars[rand() % numbers].matrix5[rand() % 15]; c = vars2[rand() % numbers].matrix5[rand() % 15]; c = vars3[rand() % numbers].matrix5[rand() % 15]; c = vars4[rand() % numbers].matrix5[rand() % 15]; c = vars5[rand() % numbers].matrix5[rand() % 15]; break;   case(6) :   c = vars[rand() % numbers].matrix6[rand() % 15]; c = vars2[rand() % numbers].matrix6[rand() % 15]; c = vars3[rand() % numbers].matrix6[rand() % 15]; c = vars4[rand() % numbers].matrix6[rand() % 15]; c = vars5[rand() % numbers].matrix6[rand() % 15]; break;   case(7) :   c = vars[rand() % numbers].matrix7[rand() % 15]; c = vars2[rand() % numbers].matrix7[rand() % 15]; c = vars3[rand() % numbers].matrix7[rand() % 15]; c = vars4[rand() % numbers].matrix7[rand() % 15]; c = vars5[rand() % numbers].matrix7[rand() % 15]; break;   case(8) :   c = vars[rand() % numbers].matrix8[rand() % 15]; c = vars2[rand() % numbers].matrix8[rand() % 15]; c = vars3[rand() % numbers].matrix8[rand() % 15]; c = vars4[rand() % numbers].matrix8[rand() % 15]; c = vars5[rand() % numbers].matrix8[rand() % 15]; break;     case(9) :   c = vars[rand() % numbers].uv[rand() % 1]; c = vars2[rand() % numbers].uv[rand() % 15]; c = vars3[rand() % numbers].uv[rand() % 15]; c = vars4[rand() % numbers].uv[rand() % 15]; c = vars5[rand() % numbers].uv[rand() % 15]; break;       }         }     system("PAUSE"); return 0; }     }     I started an Analysis and the caches  seems weird or I don't understand them. I've posted an image where L1 L2 are 0 and L3 is 0.017 and the programs seems to use big and random enough data processing. Where should I start looking especially if I need to optimize another more complex program ? Thanks [attachment=30585:vtune.jpg]      
  5. Azzazelus

    Searching with custom data

    I was doing it for learning purpose. I was taking a course where the teacher implemented a custom Vector class just to see how things work "under the hood".
  6. Hello. I've made a vector class (an realizable array but moving the array when it gets bigger etc..) and Im using templates to pass any object type like this :   template<typename ElemType> class   XVector {   }   struct myStruct { int ID; string name; etc.. }   XVector<myStruct> myVector; I made a search and a sort functions (in the XVector class) that takes the elements and compare them and in order for that to work I must overload the operators on myStruct so it can know what == or < means. So far so good but there are times when I need to sort the vector only on specific criteria for example only by ID and not by name; So instead of operator overloading I made function pointers in the class that are comparing.   int Compare(myStruct &elem1, myStruct &elem2 {  compare by elem1.id etc.. }   I make outside functions and pass them to the vector object function pointer.  Is that a normal thing to do or t here are better solutions? I'm not intersted in STL yet. Thanks.
  7. Azzazelus

    Fast C++ book

    Hello. I know the title sounds weird but..I'm learning C++ for some years now and I think I'm a little more than a beginner but I never managed to know all the rules of the language or I forgat many of them because I did not use those features. Is there any book suitable for me more like a "dictionary" or one that presents rules and examples without all the explaining ? Its boring to read books with 1000+ pages and try to skip the things I know.  Thanks.
  8. Azzazelus

    XMVector3TransformCoord

    Hello. I'm working with DirectX 11 and C++. I have a mesh with some vertices and some generated points for the bounding box (min and max vertice). I also have the transformation matrix for that mesh. When I render the mesh and another generated mesh for debug made from the min and max bounding points it renders them correctly. I just send the world transformation matrix to both original mesh and bounding mesh and everything is ok. But I want to make a function that will detect the distance between the camera (player position) and the mesh. So I need to transform the boundind vertices from local to world space and I'm using XMVector3TransformCoord(boundingVectorMin, transformationMatrix) and I get weird results. The matrix is the same as for the original mesh but when I transform the bounding vertices with that matrix (XMVector3TransformCoord) and render them with Identity matrix in the shader I dont get the same result as when I send the original matrix to the shader. Any idea why this happens ? 
  9. Azzazelus

    Maya terrain management

    Hello. I know I posted a question like this in the Visual Section but this one is more technical. I want to implement a LOD terrain system so I can export from Maya chunks of terrain with multiple level of detail. After that in my application I render them depending in the camera position. The chunks closer to the camera are rendered with the high quality mesh and high quality shaders and the ones that are far with the low terrain version. The problem that Im having right now is that I must keep the chunks the same size so I can update the DirectX buffers and not create resources all the time. Just map and unmap wit ha buffer with the same size but a different chunk. It seems that I don't know how to manually do that in Maya. I dont know how to split the big terrain mesh in multiple equal meshes that have the same size. For now I dont want to complicate things and make a script for dividing the mesh and I was wondering if there is any workaround this. If I create resources on runtime instead updating them is a big performance hit ?
  10. Azzazelus

    Maya split terrain

    Hello. I use maya to export some object and terrain (simple mesh) to my game. I reached the point where I need bigger terrain and I want to implement a lod system where the terrain is split in mutiple chuncks and every chunk has different details and I need to keep them the same size of vertices so when I load a different detail version of the chunk I dont create DirectX resources again and I just map the new buffer. So I dont know how to aproach this without having to generate the chunks by code. Is there any tool in maya that will force a number of vertices to a selected mesh ? I will manually create the terrain chunks and their lelevs of details I just need a hint how to force a fixed number of vertices.
  11. Azzazelus

    Maya baking textures

    I manage to make it work. My problem was that I didn't kept both objects in the same position.
  12. Azzazelus

    Maya baking textures

    Hello. I'm new to Maya modeling and I was trying to bake some textures and I don't understand what I'm missing. I create some pieces of geometry that I combine into a single mesh. I duplicate the single mesh for later use. I select the original mesh by faces and assign different materials with textures to different faces. So one mesh and multiple textures. I create a planar mapping. I go to the Transfer maps and set the duplicated mesh as the target and the multiple materials mesh as the source. I select the diffuse map and hit Bake. I always get a black texture. or a black texture with a little texture in the middle that does not represent all my textures combined.
  13. Azzazelus

    Maya Rotations

    Hello. I'm using Maya and its right handed coordinate system to export some models to DirectX. To display my mesh correctly (in DirectX left coordinate system)I negated the Z component on the vertex buffer and 1.0f-uv component. For the translation matrix I also negated the Z component and the objects are displayed correctly mapped and placed on the world. The problem is when I try to convert the rotations to left hand coordinate. With a function from Maya I get every rotation on its axis. For example object1 has rotationX=0, rotationY=0.8 and rotationZ = 0;  I compute those radians with XMMatrixRotationX/Y/Z but I dont know what to change to made them for left hand coordinate.
  14. Azzazelus

    Simple inheritance

    My mistake. I forgot to export the symbol fromn the library. I was building a library and that method was not exported. Thanks for the tips. I also have another question about inheritance. I want to make a system so that the user can make a vector with "windows". the window element have the description of the window but also I need to store the information about behavior on different action and I dont know how to proceed with that. For example when the user of the class adds a window with a function (CreateNewWindow(width.. etc) actually adds an struct object (with window description) to the vector that holds the "windows". But the users must also add behavior function like OnExit(), OnPaint(), OnResize() etc etc so I must update the Window Procedure function with the ewquested functions: LRESULT wProcedure(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {   switch (msg) { case WM_CREATE: {   void ClientRequestedOnCreateFunction()   return(0); } break;     case WM_DESTROY: {   void ClientRequestedOnDestroyFunction(); PostQuitMessage(0); return(0); } break;   } return(DefWindowProc(hwnd, msg, wparam, lparam)); }     Is working with function pointers a good approach ? I was thinking that inheritance doesn't work so good as I have n-windows and I don't want the user to manually create so many classes inherited and pass them to the vector.
  15. Azzazelus

    Simple inheritance

    Hello. I have a class A that has some virtual functions that are defined there but in a cpp file. So the declaration of the virtual function is in .h file in the A class and the definition is in .cpp file A::functio() { do something }. When I create another class for example B: public A and I dont want to overwrite the virtual function from A, the B class doesnt see the implementation of the function in class A(Linker errors). It only sees the implementation if I include the .cpp file of the class A. So If I have virtual function defined in the base class and sometimes I dont want to overwrite it just use it as it was implemented in the base class how the second class sees the implementation ?
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!