Store and render custom vertex color in GERenderInfo

This commit is contained in:
Benau 2022-10-18 15:07:11 +08:00
parent 1b604666c3
commit 58a00f7627
2 changed files with 10 additions and 1 deletions

View File

@ -25,6 +25,8 @@
#ifndef HEADER_GE_RENDER_INFO_HPP
#define HEADER_GE_RENDER_INFO_HPP
#include "SColor.h"
namespace GE
{
@ -35,12 +37,14 @@ private:
bool m_transparent;
irr::video::SColor m_vertex_color;
public:
// ------------------------------------------------------------------------
GERenderInfo(float hue = 0.0f, bool transparent = false)
{
m_hue = hue;
m_transparent = transparent;
m_vertex_color = (irr::video::SColor)-1;
}
// ------------------------------------------------------------------------
void setHue(float hue) { m_hue = hue; }
@ -50,6 +54,8 @@ public:
float getHue() const { return m_hue; }
// ------------------------------------------------------------------------
bool isTransparent() const { return m_transparent; }
// ------------------------------------------------------------------------
irr::video::SColor& getVertexColor() { return m_vertex_color; }
}; // GERenderInfo

View File

@ -70,7 +70,10 @@ void ObjectData::init(irr::scene::ISceneNode* node, int material_id,
m_hue_change = ri->getHue();
else
m_hue_change = 0.0f;
m_custom_vertex_color = irr::video::SColor((uint32_t)-1);
if (ri)
m_custom_vertex_color = ri->getVertexColor();
else
m_custom_vertex_color = irr::video::SColor((uint32_t)-1);
} // init
// ============================================================================