Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly formatting changes, added a few suggestions #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SpikeCifer
Copy link

Feel free to accept any change you want, or none. I myself would remove a few "separate by new line" formatting changes I've made.

return p.y;
case Axis::Z_AXIS:
return p.z;
case Axis::X_AXIS: return p.x;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intend one tab less to align with switch

@@ -0,0 +1 @@
Did I miss the performance tests?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

std::unique_ptr<BBNode> BBAccelerator::split(
size_t startIndex, size_t endIndex,
std::vector<std::pair<BoundingBox, size_t>>& boxes)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All brackets go after the function

bool hit = false;
const Vector3 invrDir = ONE_VECTOR / ray.direction;
stack[0] = m_root->left.get();
stack[1] = m_root->right.get();
stackBack = 2;
stackBack = 2; // General Suggestion of writting in snake_case

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

const BBNode* stack[128];
int stackBack;
const BBNode* current;
const BBNode* stack[128]; // Move closer to assigment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just want to allocate the array here

gloss = std::make_unique<SpecularShader>(
point.shadingNormal, point.tangent,
point.bitangent, color);
// return std::...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More readable using if/else

@@ -1,6 +1,7 @@
#include "meshes/cube.h"

Cube::Cube() : TriangleMesh() {
// Extract

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just makes a mesh, we just hardcode declare the mesh here

@@ -20,6 +20,8 @@ Plane::Plane() {
m_vertices.push_back(Vertex(p2, uv2, n));
m_vertices.push_back(Vertex(p3, uv3, n));

// At this point I know you are formating at about 100 characters,
// which I would say is the max, though I prefer 80 :P

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's random, the code has really bad formating tbh



// if parameters align with the procedures's body,
// make it easier to separate them

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I usually use two tabs here but you are right, it looks bad

@@ -37,12 +40,23 @@ int main() {
std::shared_ptr<Material> whiteMatte(new MatteMaterial(whiteTexture));
std::shared_ptr<EmissionMaterial> emissionMat(new EmissionMaterial(lightTexture, 1.3f));

// Suggestion: Assign all parameters in single variable
// Eg what does the first 500 mean for options?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's kinda fine. We get these problems all the time. Every function has values that you usually don't know what they refer to. Of course this can be done better in this specific situation but overall it's usually fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants