TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.1k stars 223 forks source link

Fragment shader color. #14

Open Cyraxx13 opened 9 years ago

Cyraxx13 commented 9 years ago

Looking at it with a fresh eye I realised why it is done the way it is, so you can mark this closed. (don't code or analize code when you are tired :) )

I've heared that the if(...) is very costly in the fragment shaderand now you have this.

if (fs_in.tid > 0.0) { int tid = int(fs_in.tid - 0.5); texColor = texture(textures[tid], fs_in.uv); } color = texColor * intensity;

You should have a static white color as an unsigned int as the default color attribute and if the Sprite is not textured you would change it in the submit method, else it is not needed because you would basically multiply the textured color with 1.

So you could have s'thing like this in the shader instead of the if(...)

color = fs_in.color * texColor * intensity;

ViktorPopp commented 3 months ago

Isn't this a bit outdated?

pengyz commented 3 months ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

ViktorPopp commented 3 months ago

Why is this chinese?