* 高亮绘制
This commit is contained in:
+22
-9
@@ -155,6 +155,14 @@ public:
|
||||
{
|
||||
_scissorRect = rect;
|
||||
}
|
||||
/**
|
||||
* @brief 设置亮度
|
||||
* @note 颜色通道乘上此值(不会超过1)
|
||||
*/
|
||||
void SetBright(float bright)
|
||||
{
|
||||
_bright = bright;
|
||||
}
|
||||
|
||||
//! 手动设置uv后,纹理区域id失效
|
||||
void SetUV(size_t index, const UV& uv);
|
||||
@@ -209,28 +217,33 @@ private:
|
||||
_viewport(nullptr),
|
||||
_scissorRect(nullptr),
|
||||
_sampler(0),
|
||||
_blend{ 0 },
|
||||
_blend{ 0 },
|
||||
_bright{ 1.0f },
|
||||
_ui(false),
|
||||
_bOwnCoor{ false }
|
||||
_bOwnCoor{ false },
|
||||
_bRoundPixel{ true }
|
||||
{}
|
||||
|
||||
Quad _quad; //64byte
|
||||
std::array<Color, 4> _col;//64byte
|
||||
std::array<Position, 4> _uv;//32byte
|
||||
Quad _quad; // 64byte
|
||||
std::array<Color, 4> _col;// 64byte
|
||||
std::array<Position, 4> _uv;// 32byte
|
||||
|
||||
//默认没有,可以直接指向rootCoor,不拥有资源
|
||||
// 默认没有,可以直接指向rootCoor,不拥有资源
|
||||
Coor* _coor;
|
||||
Position4* _viewport;
|
||||
Rect* _scissorRect;
|
||||
unsigned _sampler;
|
||||
unsigned _blend;
|
||||
float _bright; // 亮度
|
||||
|
||||
//id
|
||||
SpriteID _id;//1为纹理区域,可以为-1代表失效(手动指定uv的情况)
|
||||
SpriteID _id;// 1为纹理区域,可以为-1代表失效(手动指定uv的情况)
|
||||
|
||||
float _order;// 与z等价
|
||||
bool _ui;//影响isPickup,防止穿透
|
||||
bool _bOwnCoor;//拥有coor,为真时析构会delete coor
|
||||
bool _ui;// 影响isPickup,防止穿透
|
||||
bool _bOwnCoor;// 拥有coor,为真时析构会delete coor
|
||||
|
||||
bool _bRoundPixel;// 像素取整
|
||||
|
||||
#ifndef NDEBUG
|
||||
std::string _name;
|
||||
|
||||
+9
-2
@@ -3579,7 +3579,7 @@ void VK::Update(std::vector<DrawCall>& list_dc, std::vector<DrawCall>& list_dc_t
|
||||
}
|
||||
|
||||
// 取整像素
|
||||
if (true)
|
||||
if (spr->_bRoundPixel)
|
||||
{
|
||||
Every::Round(pos);
|
||||
}
|
||||
@@ -3590,7 +3590,7 @@ void VK::Update(std::vector<DrawCall>& list_dc, std::vector<DrawCall>& list_dc_t
|
||||
v._pos[1] = (float)pos[1];
|
||||
v._pos[2] = spr->_order;
|
||||
|
||||
if (spr->_blend)
|
||||
if (spr->_blend == 1)
|
||||
{// blend模式的 alpha需要作用到颜色上才能实现透明
|
||||
v._color = spr->_col[i];
|
||||
v._color[0] *= v._color[3];
|
||||
@@ -3599,6 +3599,13 @@ void VK::Update(std::vector<DrawCall>& list_dc, std::vector<DrawCall>& list_dc_t
|
||||
}
|
||||
else
|
||||
v._color = spr->_col[i];
|
||||
// 亮度
|
||||
if (spr->_bright != 1.0f)
|
||||
{// 可超过1.0
|
||||
v._color[0] = v._color[0] * spr->_bright;
|
||||
v._color[1] = v._color[1] * spr->_bright;
|
||||
v._color[2] = v._color[2] * spr->_bright;
|
||||
}
|
||||
v._uv = spr->_uv[i];
|
||||
}
|
||||
j += 4;
|
||||
|
||||
@@ -259,7 +259,7 @@ void UISprite::_update_base()
|
||||
if (_sprPanda->IsPickup())
|
||||
{
|
||||
_sprPandaEffect = g_factory->CloneSprite(_sprPanda);
|
||||
_sprPandaEffect->SetBlend(Sprite::Blend::EFFECT);
|
||||
_sprPandaEffect->SetBright(1.25f);
|
||||
_sprPandaEffect->Render();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user