Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ramaskrik

Pages: [1] 2 3
1
General / Re: ExMa2D [C++14] (feedback)
« on: March 08, 2016, 08:22:21 pm »
Sorry for the late response, have been a bit busier than expected. Anyway, here it is.

Some comments:

The constraint that the class must have x and y members is unnecessary. Have a look at Boost.Geometry to see how is possible to write fully generic, yet simple to use code. Basically, the idea is:
namespace lib
{

// user can specialize this class to support other types
template <typename T>
struct vector_type
{
    static auto x(const T& v) { return v.x; }
    static auto y(const T& v) { return v.y; }
};

// convenience inside library, can also be in private namespace
template <typename T>
auto x(const T& v)
{
    return vector_type<T>::x(v);
}

}
An excellent suggestion! Thanks, I will work on this in the near future.

Does SFINAE based on std::is_arithmetic actually bring an advantage? Types that don't provide the operations won't compile already, and you don't artificially limit what types users can work with.
Yeah, kinda. I am using std::numeric_limits<T>::epsilon() in the compare(), which doesn't make it an artificial limitation, but a real one. Of course, I don't call compare() in every function, do you think I should remove this constraint from those functions? Or should I implement compare() with a fixed allowed deviation?
Your functions take their parameters by value, leading to unnecessary copies.
Thanks, fixed.

The excessive type inference makes code a bit difficult to understand sometimes, and I'm not sure if it does what's intended all the time. Use it where it helps increase genericity, but in cases where you know the type, it may be helpful to write it down (even function-local as typedefs from metafunctions).
Not really great with terminology, do you mean the unnecessary auto with decltypes? If so, it has been fixed as well (in the commit above).

You can use macros to increase the readability of SFINAE. In places where it doesn't contribute to overload resolution, use static assertions instead of SFINAE, in order to create more meaningful error messages and not clutter the API.
I don't really see how would this help. Would you explain yourself a bit more clearly with an example? (I am obviously a beginner in these manners, so I tend to be a bit annoying with my lack of knowledge. Feel free to ignore this, if you find it annoying)

Operators like unary - are not helpful inside your namespace, because they're not considered by ADL unless a library type is used as an argument. The only way to use them is to extract them to the global namespace, which is a very bad idea, because a function template without constraints accepts everything, and it will defeat implicit conversions of completely unrelated code.
This is meant to be like this. I don't want to be invasive, so if user has already defined basic operators, and only wants to use higher-level functions, (s)he is free to do so.
I think I have imposed pretty strict rules on types what the functions can take. I can't imagine a scenario where a function would be inadequately generated for unwanted types. Would you mind providing such a scenario?
The function std::abs() is part of the standard library, and it's possibly more efficient than yours.
It surely is. But it is not constexpr by standard (g++ does implement it as constexpr, but clang doesn't.) Should I give up constexpr in abs, which means in compare as well, which means in a bunch of other functions as well?
utils::compare() should have a better name.
True. What would you suggest? is_equal?



It definitely does, it's common convention in C++ to use .cpp for translation units (= files that are compiled). And Hiura dabbertorres Yeah, my bad. Sorry. is also right that IDEs work according to that scheme.
Fixed. Using .tpp from now on.

90 degrees are 100 gradians, but pi/2 radians.
I didn't mean to imply that 100 rad is 90 deg (although it could have been understood like that, good catch!), I just used arbitrary values. Anyway, didn't know about gradians, thanks for the info!

Note that those last quotes were not from me but from dabbertorres.  ;)
Sorry, using phone is not the best way how to write comprehensive posts. It has been fixed. :)



I have missed a part of your previous post, Hiura, so here's my response:
I use `normal` in my codebase actually. It's a noun/adj, not a verb, but it makes it clear enough I believe. One could also expect `orthogonal` since it's mostly a synonym.
I like to use verb as function names, and normal could be mixed up with normalize, and the similarity doesn't really contribute to IntelliSense as well. Also orthogonize is no better :) So even when it's a made up name, IMHO it does the job the best. Just my preference, really. :) (want to be as transparent as possible :) )

2
General / Re: ExMa2D [C++14] (feedback)
« on: March 06, 2016, 10:16:43 pm »
For what it's worth, I was a bit confused as to why the extension was .cpp at first. ..
Well, if it really confuses people I'll probably go with a different extension.
A compiler will try to compile a .cpp unless set otherwise, which would give a fair amount of errors!
I am a long time CMake Linux user and I have never had a problem with an eager compiler. I am sure CMake creates valid VisualStudio files as well, so I wouldn't see this as a problem.
Otherwise, I like it! Looks well done to me!
I am so happy you guys like it. This is my first serious attempt to make open-source project more could benefit from, so my happinness is even bigger. :-)
http://glm.g-truc.net/0.9.7/index.html
Of course, I do know about spectacular GLM library. However, GLM has slightly different use-cases than exma2d. GLM is a general math library with all the complexities it bears, while exma2d is a quick'n'dirty easy-to-use easy-to-dive-into strictly 2d library with a tiny codebase. GLM probably has got a lot of optimizations in terms of speed and efficiency, while exma2d's selling point is compatibilty with your already defined types and usage of C++14 (for instance, you no longer have to find out whether you need to pass degrees or radians, simply pass 90_deg or 100_rad and enjoy yourself. It is also clearer for anyone else reading the code after you.).

// edit: WOW Nexus, great feedback, I'll tackle your post tomorrow, until then, let me at least thank you for time :-)

3
General / Re: ExMa2D [C++14] (feedback)
« on: March 06, 2016, 05:03:12 pm »
Looks cool, not intrusive and all that good stuff! :-)
Thank you for your great feedback!

- use `.tpp` or `.inl` instead of `.cpp` if the file is only meant to be included in a header file to implement templated features.
I initially used .inl, but I ceased to do so for two reasons. The first one is that the different extension doesn't really bring anything. I don't and won't use non-template files, so it doesn't help in differentating template from non-template implementations. I also make clear in README the library is header-only. Second one is that a great number of editors don't support c++ syntax highlighting for .inl nor .tpp rightaway, but they do it for .cpp. I know this is changeable, but I don't want to make potential contributors to go find that, just because this library is header-only.
Those are the things I have considered when doing this decision, if there's more to this, I'll be glad to hear you out!

- maybe rename `perpendicule` into an actual verb/noun? It feels weird but this is just my taste
what is the actual verb? I wanted to keep the name as short as possible (make_perpendicular seemed too long to me) and perpendicule, despite being a made-up name clearly expresses what is the function about.

- but fix it at least.  ;) https://github.com/LeviTaule/exma2D/blob/master/include/exma2D/impl/vector2D.cpp#L150 should read `return {-vector.y, vector.x};`
good catch. I actually kind of screwed up doing the tests for this, so I didn't catch it myself. Thank you, I fixed it here.

- pretty cool all those constexpr functions!
 - I'm wondering though if `distance` and `rotate` can really be constexpr...
constexpr FTW! Again, thank you, fixed it here.
- there's a bit of duplication here and there; e.g. != and ==, or normalize and /.
You should seriously claim these commits, including this one. :)

- you don't use has_quiet_NaN everywhere
You have got one more commit to claim :)

Thank you! :D

4
General / ExMa2D [C++14] (feedback)
« on: March 05, 2016, 05:24:40 pm »
Hi everyone!
This is not a project directly related to SFML, but it is intended to be compatible with SFML. Feel free to (re)move this topic if this is inappropriate.

Brief intro
ExMa2D is a tiny templated 2D vector and matrix library written in C++14. Currently only vector part is implemented, transform matrices are on their way.  It lives in Github repo LeviTaule/exma2D and is licensed under zlib/libpng license.

Motivation
I know, I should not be reinventing the wheel and stuff, but I think it is meaningful from educational perspective to write such a library (for me and, hopefully, for the others). Also, I am planning to write a 2D collision detection and response library in the future, so this may become handy.

Details
This library is a bit different than a usual vector library. It doesn't actually define a vector2D class, it implements some useful 2D vector operations on top of a vector library.
There are 2 requirements for such class, however:
  • It must have public x and y members, and they must be arithmetic
  • It must have the ability to initialize itself via argument list
For instance, these requirements are fulfilled by this class:

struct VectorF
{
    float x, y;
};

sf::Vector<T> is a valid candidate as well.

Example
(It doesn't do anything useful nor meaningful, just demonstrates the usage)
#include "exma2D/vector2D.hpp"
using namespace exma::vector;

struct VectorF
{
    float x, y;
};

constexpr VectorF vec{2.f, 5.f};
constexpr VectorF origin{0.f, 0.f};

constexpr auto crazy = -perpendicule(vec)
constexpr auto silly = project(crazy, vec) * 3;
constexpr auto crazy_silly = reflect(crazy, silly);
constexpr auto go_round = rotate(crazy_silly, origin, 180_deg);

auto length = len(go_round);
constexpr auto dot_product = dot(crazy, silly);

So what the hell I want from you?
Feedback.
I have noticed that people visiting SFML forums are cool folks and great programmers with a deep knowledge of modern C++. I would be very glad if you visited exma2D repository, skimmed through/read the code, maybe tried using it if you have some time, and then gave me some feedback on C++11/14 usage, library design (as this is my first open-source library), best practices and anything else you'd like to point out.

Eeeh....
Yes, I have been partially inspired to post here by this topic.

5
General discussions / Re: SFML 3D logo
« on: March 01, 2016, 06:45:21 pm »
I worked on a very basic 3D logo (using Blender) for a project and I came up this:

Forgive me for asking, but why a 3D-Logo for a 2D-Library? I think it's odd.

Not to mention, SFML is not strictly 2D. Many people use SFML as full-blown media library but for graphics, which they handle via OpenGL directly. So if one is making a 3D game in SFML and OpenGL, 3D SFML logo may come handy.

6
General discussions / Re: Will SFML support windowing for Vulkan?
« on: March 01, 2016, 06:41:52 pm »
There is a topic about Vulkan support already: http://en.sfml-dev.org/forums/index.php?topic=19822.0

7
It seems the problem is in the preprocessor-parsing stage, (not linking stage), as it cannot find an SFML header. Have you copied the SFML hpp files into the C:\Users\merijin\Documents\sfml\lib? Didn't you want to put there something like C:\Users\merijin\Documents\sfml\include?

8
Network / Re: Error while using the networking module in VS express 2015
« on: February 20, 2016, 11:41:40 am »
The example is complete..

Mea Culpa, I didn't notice it was a Github project. I thought he was talking about one of the examples on the official SFML tutorial page (smth like this: http://www.sfml-dev.org/tutorials/2.3/network-socket.php)

That's what you get for just skimming the posts :D

9
General / Re: SFML book, chapter 2 issue
« on: February 20, 2016, 09:24:10 am »
Textures::ID doesn't exist in the TextureHolder.h

Move your Textures::ID enum to the TextureHolder.h (or, even better, movie it to a new file and include the file where appropriate)

10
Network / Re: Error while using the networking module in VS express 2015
« on: February 20, 2016, 09:18:47 am »
Not every example on official SFML page is instantly runnable. More specifically, those which lack int main() certainly aren't.

Tutorials are a good source of knowledge for beginners, but in order to get past the initial "noob stage", you need to write a code that fails, fix it, see it execute gracefully. Repeat so many times you stop tracking the number of it. Then tadahh - you can write a simple program from top of your head.

11
General / Re: SFML book, chapter 2 issue
« on: February 20, 2016, 09:09:32 am »
Are you sure you include the sf::Texture header in that file?

Something like
#include <SFML/Graphics/Texture.hpp>
or
#include <SFML/Graphics.hpp>

12
Network / Re: Error while using the networking module in VS express 2015
« on: February 18, 2016, 02:07:29 pm »
You miss the entry point (int main()) of your application. You need to define it, as that is what gets called when you run your executable. In that function you call all the other functions you want to get executed.

Please learn C++ (for instance you could start here), make some console programs, etc. before trying to use an external library. Otherwise you'll just get confused.

13
Graphics / Re: sfml rendertexture with intel gpu
« on: February 17, 2016, 10:06:58 pm »
I'm not clear as to which version of SFML you are using. Did you download (from the SFML website) and install it, or download (from GitHub) the source and build it?

He has mentioned several times he's got the SFML installed via apt-get from the Ubuntu package archives
(click to show/hide)

Does anybody know if this specific problem is fixed and on which branch (if it isn't merged yet)? Anyone have exactly the same problem with one version and not have it with another?
I am not sure, but it seems the same / a similar bug was fixed in 2.2 release (which the OP most likely doesn't have).

So... any recommendations / work-around?

I'm using OpenGL version 1.3 mesa 10.1.3, the latest on 14.0.4.3 LTS; I'm sure there are people using older versions than me...
You probably meant 14.04 LTS, right? (There's nothing like 14.0... version of Ubuntu) In that case, as you may see on the link I posted above, your version of SFML is most likely 2.1:
Quote from: Ubuntu Package Search
trusty (14.04LTS) (libdevel): Simple and Fast Multimedia Library - Development Files [universe]
2.1+dfsg-4ubuntu2: amd64 i386

The newest version, however, is 2.3.

14
General / Re: How to compile a binary for different Linux systems
« on: February 16, 2016, 07:42:04 pm »
Thank you Arcade, I'll use that as a temporary option.

15
General / Re: How to compile a binary for different Linux systems
« on: February 16, 2016, 06:24:34 pm »
OK, thanks for the info, I'll look into it.

Pages: [1] 2 3
anything