If there are errors in the code, terminology, etc. in the text, please correct me
Article directory
foreword
-
of this program
Click on the entity to display the properties of the spriterenderer component of the entity in the property panel , which should include color, texture, shader, etc. (texture), but only the color is displayed for now
-
How to achieve
Same as section 86 and 85, only need to determine whether there is this component, and then pass it into the Api of ImGui
the code
// 实体transform组件
if (entity.HasComponent<SpriteRendererComponent>()) {
if (ImGui::TreeNodeEx((void*)typeid(SpriteRendererComponent).hash_code(), ImGuiTreeNodeFlags_DefaultOpen, "Sprite Renderer")) {
auto& src = entity.GetComponent<SpriteRendererComponent>();
ImGui::ColorEdit4("Color", glm::value_ptr(src.Color));
// 展开树节点
ImGui::TreePop();
}
}
blending effect
-
premise
Green renders first, red renders later
-
When the two z are the same , there is no mixing effect
-
When red z= -0.5, green z=0, there is a mixed effect
Red is behind green, and red is rendered after , so it will blend
-
When red z=0, green z= -0.5 , no mixing effect
Red is rendered in front of green, and red is rendered after , so it doesn't mix