add grids panel
This commit is contained in:
@@ -5,11 +5,14 @@
|
||||
|
||||
ui::Plane NodeImage::m_plane;
|
||||
Sampler NodeImage::m_sampler;
|
||||
Sampler NodeImage::m_sampler_mips;
|
||||
|
||||
void NodeImage::static_init()
|
||||
{
|
||||
m_plane.create<1>(1, 1);
|
||||
m_sampler.create();
|
||||
m_sampler_mips.create();
|
||||
m_sampler_mips.set_filter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
|
||||
}
|
||||
|
||||
Node* NodeImage::clone_instantiate() const
|
||||
@@ -51,6 +54,9 @@ void NodeImage::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* at
|
||||
Node::parse_attributes(ka, attr);
|
||||
switch (ka)
|
||||
{
|
||||
case kAttribute::Mips:
|
||||
m_use_mipmaps = attr->BoolValue();
|
||||
break;
|
||||
case kAttribute::Path:
|
||||
m_path = attr->Value();
|
||||
m_tex_id = const_hash(attr->Value());
|
||||
@@ -75,7 +81,8 @@ void NodeImage::draw()
|
||||
{
|
||||
using namespace ui;
|
||||
TextureManager::get(m_tex_id).bind();
|
||||
m_sampler.bind(0);
|
||||
auto& sampler = m_use_mipmaps ? m_sampler_mips : m_sampler;
|
||||
sampler.bind(0);
|
||||
glEnable(GL_BLEND);
|
||||
if (m_use_atlas)
|
||||
{
|
||||
@@ -90,7 +97,7 @@ void NodeImage::draw()
|
||||
ui::ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ui::ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||
m_plane.draw_fill();
|
||||
m_sampler.unbind();
|
||||
sampler.unbind();
|
||||
TextureManager::get(m_tex_id).unbind();
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user