Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post Posted: June 29th, 2017, 8:49 pm 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
sorry i didn't respond for so long.
i'll upload a cleaned solution but i think meeting on discord would be faster to quikly explain.
btw i'm not receiving emails from this thread altough it says i'm subscribed?


Last edited by paulboon on June 29th, 2017, 9:43 pm, edited 1 time in total.

Top 
 Profile  
Reply with quote  
 Post Posted: June 29th, 2017, 9:13 pm 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
this is the solution
maybe i made a mistake cleaning it but i couldn't find the video were it explained the steps for cleaning.

i'll be sitting in the general discord chat for a couple hours to that way talking back and forth would be a lot quicker


Attachments:
Engine.zip [1.75 MiB]
Downloaded 6 times
Top 
 Profile  
Reply with quote  
 Post Posted: June 29th, 2017, 9:53 pm 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
notification emails were landing in spam.
fixed it now so i'll respond quicker in the future


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 3:17 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2828
Location: Oklahoma, United States
Haven't gotten to the missing pixel issue, BUT you are leaking memory (BADLY). Each frame you are allocating a new LitShader and never deleting it. In Release mode, mem was leaking about 1 MB every 8 seconds on my computer.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 5:42 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3470
Location: Japan
Nice to see some stuff being made with the 3D Fundamentals graphics subsystem. Like papa, I'm not sure about some of the design / coding decisions you've made, but the fact that you are trying to do it yourself and get that understanding of how the theory works is very impressive, so keep up the good work.

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 8:10 am 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
Issue solved.
The probem was the counter variable in EdgeWalker being an int instead of a float which caused rounding issues.
also i was rounding it down in the constructor which wasn't nescessary and left gaps.

struct EdgeWalker : public IEdgeCodeGetter {
int counter;<------------should be: float counter
std::map<EdgeWalkerCode, float> posMap;
std::map<EdgeWalkerCode, float> incsMap;


Last edited by paulboon on July 1st, 2017, 8:12 am, edited 1 time in total.

Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 8:12 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2828
Location: Oklahoma, United States
Sweet, glad you figured that one out. Don't forget about the memory leak, I dare say that's the most important issue.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 8:36 am 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2828
Location: Oklahoma, United States
I'm going to go out on a limb here and say you came from a managed language, maybe something like C# or Java judging by your code. You do object oriented programming and some of your struct/classes are pretty abstract, like the Vector classes, so I feel you have experience with OOP languages. C++ offers operator overloading which would eliminate your math functions from your Vector and Matrix classes and make the code a lot more readable IMO. Also, you can use the constructor instead of having to make a separate copy function, a bonus is the copy constructor and copy assignment operator are usually made for you, so you don't have to declare or define them.

Something like this:
Code:
Vector3 lerp( const Vector3 &Dest, float Weight )const
{
   return *this + ( ( Dest - *this ) * Weight );
}

would be a lot more readable than:
Code:
Vector3 lerp(Vector3& v, float weight)
{
   return c().add( v.c().sub( ( *this ) ).scale( weight ) );
}


I spent more time than I'd like to admit trying to refactor the code to using overloaded operators, however, I found there were going to be places that I would mess up on. The reason being your math functions take in a reference and return a new instance of a Vector2/Vector3.

In some places in your code, you use the return value, and in some places you don't. Since your math functions also modify the instance, you are having to make copies in order to leave the original as-is. As I said, you can do this with the constructor instead of having to create a separate function. If you kept your code the same and removed the c() function, it would look like:
Code:
Vector3 lerp(Vector3& v, float weight)
{
   return Vector3( *this ).add( Vector3( v ).sub( ( *this ) ).scale( weight ) );
}


Anyway, it's your style, just wanted to point out somethings that you might not have known.

I would suggest more than anything to look into passing parameters by const reference, especially those std::vectors. Most of the time you are creating them as you pass them, so it may not make a difference in those places as the std::vectors are move constructed into those parameters. Just something you might look into, passing by const reference and move semantics.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 8:43 am 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
I prefer overloaded operators too but i couldn't get them to work.
I was getting a lot of compiler errors for reasons i didn't understand so i took the easy way out.


Top 
 Profile  
Reply with quote  
 Post Posted: July 1st, 2017, 8:49 am 
 

Joined: February 11th, 2017, 3:02 pm
Posts: 10
btw what do you mean with "std vectors are move constructed"?


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron