Jump to content
  • Advertisement

ryt

Member
  • Content Count

    331
  • Joined

  • Last visited

Community Reputation

297 Neutral

About ryt

  • Rank
    Member

Personal Information

  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm just curious how standard implementations of new and malloc() work. Do they use continuous memory allocation or something else? Because as you sad the memory could end up fragmented and we could arrive at the case where we have enough free memory but not a block (with continuous memory) big enough that we can use another new. In this case we would have to resort to some other implementation that does not use continuous memory and therefore not an O(1).
  2. I recently started to explore how operator new and malloc() really work. If I understood correctly they get implemented using linked-list or forward-list when an array is used. This is probably because free (dynamic, heap) memory gets allocated all over (within its bounds) the memory and so something like std::vector isn't used, something that has continuous allocation. If this is true than accessing such memory (through []) would not have access time of O(1) but some other, more complex. Is this true or I misplaced something?
  3. I created my simple Float2 struct and defined it like this: struct Float2 { float _x; float _y; Float2() {} Float2(float x, float y) { _x = x; _y = y; } Float2(const Float2& copy) = default; Float2& operator=(const Float2& copy) = default; Float2(Float2&& move) = default; Float2& opeartor=(Float2&& move) = default; } On last line for move assignment operator I get an ambiguous error and I can't compile. The error under "move" is saying that it should be preceded with ")" and error under "=" is saying that is expecting an expression. Why is this, did I do something wrong? Edit: Oh, on last line I wrote "opeartor" instead of "operator". BTW, is this ok how I created my struct? Are all the defaults necessary? I want my struct to use move when applicable instead of copy so I can get faster operations like addition.
  4. Yes it is. I decided to create a dummy vector class for interaction between engine parts. This vector is not dependent neither on SimpleMath::Vector2 nor sf::Vector2f. For the game part where code is more performance oriented I decided to use only sf::Vector2f as it's better integrated with Sfml and Thor. If I decide that sf::Vector2f is not good enough I'll just switch this part without changing the engine.
  5. I tried using Adapter and Facade patterns. I built new classes in my code to support that so now I have initial code for Allegro and Sfml. With Allegro I'm using SimpleMath:Vector2 as it has more functions than Allegro counter part. Actually I'm not really sure Allegro has such thing. Now that I have Sfml too, I wanted to use it's sf::Vector2f but I don't want to create another facade around these two types of vectors. Also in a lot of places I use SimpleMath::Vector2 that I just don't want to find and replace with sf::Vector2f. What would be your advice on this? Generally I would like more to use sf::Vector2f as it's more integrated to Sfml than SimpleMath::Vector2 is in Allegro. Also Sfml has Thor math library that adds additional functionality.
  6. Aren't we than arriving to the matrix in left-hand form or it's still in a right-hand?
  7. Ok, let's take an example, column vectors: cos -sin 0 0 x cos*x - sin*y sin cos 0 0 x y = sin*x + cos*y 0 0 1 0 z z 0 0 0 1 1 1 and for row vectors: x y z 1 cos -sin 0 0 cos*x + sin*y x sin cos 0 0 = -sin*x + cos*y 0 0 1 0 z 0 0 0 1 1 so we obviously get different results. What do they mean? Should we maybe transpose rotation matrix when we use row vectors? Aren't we than using left-hand rotation matrix?
  8. Does this then affects row and column vectors and matrix multiplication?
  9. Ok, so than it must be as @alvaro sad that arithmetic is independent of handness and that library has nothing to do with it. As I understand it it's only dependent on LookAt and Projection matrices. What confuses me now are the rotations. It must be that we only perceive the clockwise and counter-clockwise rotations for left and right systems respectively. If that's true than the object rotates only in "one" way and the way we perceive it depends LookAt and Projection functions?
  10. What I think it is, though I might have it wrong, is that libraries have a predefined basis vectors pointing in desired direction, left-hand or right-hand. If that would be true than all it's functions should use these basis vectors inside functions like cross() and others, which seems not likely possible to me.
  11. I read now about NDC and I think it's not what I'm asking. As I understood NDC is when you start to use rasterizer to present the world to the screen. In my case I don't need to present anything to the screen or calculate projection matrices or something similar, I just need a world (space) that behaves according to the left-hand rule. So that for e.g. if you want a ship to move in positive z-axis and if your x-axis is pointing away from you, y-axis pointing up then the ship should move to the left. If a ship would move right than it would be a right-hand system. That was also my initial intention, to have it move to the left side and create such system.
  12. How do you decide this when creating a new library?
  13. Ok, this is if I started initially with a right-hand coordinates, but what made the initial system from start right-handed?
  14. I think it should be as each library could be different, it does not need to do something the way other library did it. You mentioned fixed part of pipeline, what about non-fixed, every middle-ware could do it in its own way. And what about the ones that don't use a pipeline at all, that are not used for graphics at all for e.g. They could be just a library for a physics system in some institution, but still they would have to take care of the "handness".
  15. Where do this assignments to (1,0,0) "to right of screen", (0,1,0) "upwards" and (0,0,1) "away" happen? I never seen such declarations in none of libraries. Coming back to my own library that I build some time ago, mentioned in the first topic, I also never defined something similar. All I had is a struct for vectors, functions for their additions, cross, dot and others and a matrix class with rotations. I copied all from a math book. Yet when I had to do the rotations my resulting rotated vertices were rotated in a right-hand style. I never defined where my "right to the screen" and others were. It could be that I missed or overlooked something. So to understand completely I thought to create a similar system from the beginning but it to be in left-hand style. This is where I stuck.
  • 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!