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

Update color_picker and implement _draw_polygon. Fixes #8372 #8425

Closed
wants to merge 1 commit into from

Conversation

MarianoGnu
Copy link
Contributor

@akien-mga
Copy link
Member

@MarianoGnu Your changes don't follow the style enforced by clang-format, see https://travis-ci.org/godotengine/godot/jobs/222601404


storage->frame.canvas_draw_commands++;

#if 0
Copy link
Member

Choose a reason for hiding this comment

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

You're completely changing the implementation of _draw_polygon, is the code below obsolete? What about the WebGL specific stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the bellow code is from GLES2, i have no idea if it works on WebGL, but if draw_primitive works on webgl this should too, since i used it as base to write it.
I expected to give a fast solution and let someone specialized on renderer to improve it latter.

I have not idea of how clang format's the code...

@akien-mga akien-mga requested a review from reduz April 24, 2017 09:31
@MarianoGnu
Copy link
Contributor Author

@reduz ping ?

@reduz
Copy link
Member

reduz commented May 7, 2017 via email

stride += 2;
}

float b[(2 + 2 + 4) * p_vertex_count];
Copy link

@paultech paultech May 13, 2017

Choose a reason for hiding this comment

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

Variable Length Arrays are not allowed in C++.
Use

float* b = new float[(2 + 2 + 4) * p_vertex_count]();

I'm investigating if we can limit the memory allocation in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can't unless you limit the number of vertexes in polygons. this function is also used bt polygon2d nodes and collisionpolygon2d editor helper, so you cant be sure how many vertexes there are going to be. By the other hand, i didn't have any errors compiling, that's weird

Choose a reason for hiding this comment

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

GCC will grandfather VLA from c99 into c++, may be why it compiled?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, we should probably use a RealPoolArray in this case, to "stay godot" 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think using raw arrays is faster to copy to gpu memory since memory allocation is fixed, but i'm not expert in low level...

Choose a reason for hiding this comment

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

Both options result in the same memory layout, there is no speed difference between the two when copying to the GPU. The end result is the same. PoolRealArray is just the "godot" way.

@toger5
Copy link
Contributor

toger5 commented May 27, 2017

this would be really nice to get merged.
or ist he draw poly implementation still in discussion

@nunodonato
Copy link
Contributor

this would be really nice to get merged.
or ist he draw poly implementation still in discussion

i think its pending for a review from @reduz

@MarianoGnu
Copy link
Contributor Author

@akien-mga do you have some article so i can figure out what's the clang-format and why the code doesn't fit so i can fix that?

@toger5
Copy link
Contributor

toger5 commented Jun 11, 2017

there is a clang .clang-format in the git project. you install clang format on your computer. and than you run clang-format -file /godot/scene/theNextFolder/theFileToFormat.cpp

@akien-mga
Copy link
Member

The _draw_polygon part is superseded by 41c3ca3. Do you want to rebase your commit to keep only the fix for ColorPicker, or redo it in another PR?

@MarianoGnu
Copy link
Contributor Author

i'll close this PR and open a new one, since color_picker.cpp has some merge conflics from another commit. I hope i can do this in the next days, but the sources are at home and i have not internet there yet :(

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

Successfully merging this pull request may close these issues.

7 participants