update UTI, remove blur from CompDraw mask
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
<true/>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.panorama-image</string>
|
||||
<string>com.panopainter.image</string>
|
||||
</array>
|
||||
<key>LSTypeIsPackage</key>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<key>QLSupportedContentTypes</key>
|
||||
<array>
|
||||
<string>com.panopainter.image</string>
|
||||
<string>public.panorama-image</string>
|
||||
</array>
|
||||
<key>QLSupportsSearchableItems</key>
|
||||
<true/>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<key>QLSupportedContentTypes</key>
|
||||
<array>
|
||||
<string>com.panopainter.image</string>
|
||||
<string>public.panorama-image</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<string>QLGenerator</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.panopainter.image</string>
|
||||
<string>public.panorama-image</string>
|
||||
</array>
|
||||
</dict>
|
||||
@@ -79,7 +80,7 @@
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>public.panorama-image</string>
|
||||
<string>com.panopainter.image</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.mime-type</key>
|
||||
|
||||
@@ -78,7 +78,11 @@ void main()
|
||||
stroke.a = clamp(blend_stroke(stroke.a, dual.a, dual_alpha, dual_blend_mode), 0.0, 1.0);
|
||||
}
|
||||
|
||||
stroke.a = mask ? stroke.a * blur(tex_mask, uv).r : stroke.a;
|
||||
// Don't use blur to sample the mask
|
||||
// it breaks blend_mode value MacBook with Intel HD Graphics 6000
|
||||
if (mask)
|
||||
stroke.a = stroke.a * texture(tex_mask, uv).r;
|
||||
|
||||
if (!lock && base.a == 0.0)
|
||||
{
|
||||
frag = stroke * vec4(1.0, 1.0, 1.0, alpha);
|
||||
|
||||
@@ -82,7 +82,7 @@ class CanvasModePen : public CanvasMode
|
||||
// resizing the tip
|
||||
bool m_resizing = false;
|
||||
public:
|
||||
CanvasModePen() { hide_curor = true; }
|
||||
CanvasModePen() { hide_curor = true; m_picking = false; }
|
||||
|
||||
virtual void on_GestureEvent(GestureEvent* ge) override;
|
||||
virtual void on_MouseEvent(MouseEvent* me, glm::vec2& loc) override;
|
||||
|
||||
@@ -53,7 +53,7 @@ std::string Shader::read(const std::string& path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Shader::parse_error(const char* msg, const char* code)
|
||||
void Shader::parse_error(const std::string& msg, const std::string& code)
|
||||
{
|
||||
auto code_lines = split(code, '\n');
|
||||
auto error_lines = split(msg, '\n');
|
||||
@@ -110,7 +110,7 @@ bool Shader::load(const std::string& path)
|
||||
{
|
||||
*sections["vertex"] = SHADER_VERSION + *sections["vertex"];
|
||||
*sections["fragment"] = SHADER_VERSION + *sections["fragment"];
|
||||
if (create(sections["vertex"]->c_str(), sections["fragment"]->c_str()))
|
||||
if (create(*sections["vertex"], *sections["fragment"]))
|
||||
{
|
||||
m_path = path;
|
||||
return true;
|
||||
@@ -152,10 +152,10 @@ bool Shader::reload()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Shader::create(const char* vertex, const char* fragment)
|
||||
bool Shader::create(const std::string& vertex, const std::string& fragment)
|
||||
{
|
||||
bool ret = true;
|
||||
App::I->render_task([&]
|
||||
App::I->render_task([this, &ret, vertex, fragment]
|
||||
{
|
||||
GLint status;
|
||||
static char infolog[4096];
|
||||
@@ -168,7 +168,7 @@ bool Shader::create(const char* vertex, const char* fragment)
|
||||
ret = false;
|
||||
return;
|
||||
}
|
||||
source = vertex;
|
||||
source = vertex.c_str();
|
||||
glShaderSource(vs, 1, &source, nullptr);
|
||||
glCompileShader(vs);
|
||||
glGetShaderiv(vs, GL_COMPILE_STATUS, &status);
|
||||
@@ -192,7 +192,7 @@ bool Shader::create(const char* vertex, const char* fragment)
|
||||
ret = false;
|
||||
return;
|
||||
}
|
||||
source = fragment;
|
||||
source = fragment.c_str();
|
||||
glShaderSource(fs, 1, &source, nullptr);
|
||||
glCompileShader(fs);
|
||||
glGetShaderiv(fs, GL_COMPILE_STATUS, &status);
|
||||
@@ -256,14 +256,18 @@ bool Shader::create(const char* vertex, const char* fragment)
|
||||
GLint count;
|
||||
GLint size; // size of the variable
|
||||
GLenum type; // type of the variable (float, vec3 or mat4, etc)
|
||||
const GLsizei bufSize = 16; // maximum name length
|
||||
const GLsizei bufSize = 64; // maximum name length
|
||||
GLchar name[bufSize]; // variable name in GLSL
|
||||
GLsizei length; // name length
|
||||
glGetProgramiv(ps, GL_ACTIVE_UNIFORMS, &count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
glGetActiveUniform(ps, (GLuint)i, bufSize, &length, &size, &type, name);
|
||||
m_umap[(kShaderUniform)const_hash(name)] = glGetUniformLocation(ps, name);
|
||||
name[length] = 0;
|
||||
kShaderUniform id = (kShaderUniform)const_hash(name);
|
||||
if (m_umap.find(id) != m_umap.end())
|
||||
LOG("UNIFORM ALREADY DEFINED: %s", name);
|
||||
m_umap[id] = glGetUniformLocation(ps, name);
|
||||
//printf("Uniform #%d Type: %u Name: %s Loc: %d\n", i, type, name, glGetUniformLocation(ps, name));
|
||||
}
|
||||
}
|
||||
@@ -325,6 +329,10 @@ void Shader::u_int(kShaderUniform id, int i)
|
||||
else
|
||||
glUniform1i(m_umap[id], i);
|
||||
}
|
||||
void Shader::u_int(const char* name, int i)
|
||||
{
|
||||
glUniform1i(glGetAttribLocation(prog, name), i);
|
||||
}
|
||||
void Shader::u_float(kShaderUniform id, float f)
|
||||
{
|
||||
if (m_umap.count(id) == 0)
|
||||
@@ -350,7 +358,7 @@ bool ShaderManager::reload()
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ShaderManager::create(kShader id, const char* vertex, const char* fragment)
|
||||
bool ShaderManager::create(kShader id, const std::string& vertex, const std::string& fragment)
|
||||
{
|
||||
m_shaders[id].name = id;
|
||||
return m_shaders[id].create(vertex, fragment);
|
||||
@@ -393,6 +401,11 @@ void ShaderManager::u_int(kShaderUniform id, int i)
|
||||
m_current->u_int(id, i);
|
||||
}
|
||||
|
||||
void ShaderManager::u_int(const char* name, int i)
|
||||
{
|
||||
m_current->u_int(name, i);
|
||||
}
|
||||
|
||||
Shader* ShaderManager::get(kShader id)
|
||||
{
|
||||
auto it = m_shaders.find(id);
|
||||
|
||||
@@ -88,10 +88,10 @@ class Shader
|
||||
std::string read(const std::string& path);
|
||||
public:
|
||||
kShader name;
|
||||
void parse_error(const char* msg, const char* code);
|
||||
void parse_error(const std::string& msg, const std::string& code);
|
||||
bool load(const std::string& path);
|
||||
bool reload();
|
||||
bool create(const char* vertex, const char* fragment);
|
||||
bool create(const std::string& vertex, const std::string& fragment);
|
||||
void destroy();
|
||||
void use();
|
||||
void u_vec4(kShaderUniform id, const glm::vec4& v);
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
void u_vec2(kShaderUniform id, const glm::vec2& v);
|
||||
void u_mat4(kShaderUniform id, const glm::mat4& m);
|
||||
void u_int(kShaderUniform id, int i);
|
||||
void u_int(const char* name, int i);
|
||||
void u_float(kShaderUniform id, float f);
|
||||
GLint GetAttribLocation(const char* name);
|
||||
};
|
||||
@@ -111,7 +112,7 @@ public:
|
||||
static bool ext_framebuffer_fetch;
|
||||
static bool load(kShader id, const std::string& path);
|
||||
static bool reload();
|
||||
static bool create(kShader id, const char* vertex, const char* fragment);
|
||||
static bool create(kShader id, const std::string& vertex, const std::string& fragment);
|
||||
static void use(kShader id);
|
||||
static void use(const char* name);
|
||||
static Shader* get(kShader id);
|
||||
@@ -120,6 +121,7 @@ public:
|
||||
static void u_vec2(kShaderUniform id, const glm::vec2& v);
|
||||
static void u_mat4(kShaderUniform id, const glm::mat4& m);
|
||||
static void u_int(kShaderUniform id, int i);
|
||||
static void u_int(const char* name, int i);
|
||||
static void u_float(kShaderUniform id, float f);
|
||||
static void invalidate();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user