update UTI, remove blur from CompDraw mask
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>LSItemContentTypes</key>
|
<key>LSItemContentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
|
<string>public.panorama-image</string>
|
||||||
<string>com.panopainter.image</string>
|
<string>com.panopainter.image</string>
|
||||||
</array>
|
</array>
|
||||||
<key>LSTypeIsPackage</key>
|
<key>LSTypeIsPackage</key>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<key>QLSupportedContentTypes</key>
|
<key>QLSupportedContentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>com.panopainter.image</string>
|
<string>com.panopainter.image</string>
|
||||||
|
<string>public.panorama-image</string>
|
||||||
</array>
|
</array>
|
||||||
<key>QLSupportsSearchableItems</key>
|
<key>QLSupportsSearchableItems</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<key>QLSupportedContentTypes</key>
|
<key>QLSupportedContentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>com.panopainter.image</string>
|
<string>com.panopainter.image</string>
|
||||||
|
<string>public.panorama-image</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSExtensionPointIdentifier</key>
|
<key>NSExtensionPointIdentifier</key>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
<string>QLGenerator</string>
|
<string>QLGenerator</string>
|
||||||
<key>LSItemContentTypes</key>
|
<key>LSItemContentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
|
<string>com.panopainter.image</string>
|
||||||
<string>public.panorama-image</string>
|
<string>public.panorama-image</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
@@ -79,7 +80,7 @@
|
|||||||
<string>public.data</string>
|
<string>public.data</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UTTypeIdentifier</key>
|
<key>UTTypeIdentifier</key>
|
||||||
<string>public.panorama-image</string>
|
<string>com.panopainter.image</string>
|
||||||
<key>UTTypeTagSpecification</key>
|
<key>UTTypeTagSpecification</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>public.mime-type</key>
|
<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 = 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)
|
if (!lock && base.a == 0.0)
|
||||||
{
|
{
|
||||||
frag = stroke * vec4(1.0, 1.0, 1.0, alpha);
|
frag = stroke * vec4(1.0, 1.0, 1.0, alpha);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class CanvasModePen : public CanvasMode
|
|||||||
// resizing the tip
|
// resizing the tip
|
||||||
bool m_resizing = false;
|
bool m_resizing = false;
|
||||||
public:
|
public:
|
||||||
CanvasModePen() { hide_curor = true; }
|
CanvasModePen() { hide_curor = true; m_picking = false; }
|
||||||
|
|
||||||
virtual void on_GestureEvent(GestureEvent* ge) override;
|
virtual void on_GestureEvent(GestureEvent* ge) override;
|
||||||
virtual void on_MouseEvent(MouseEvent* me, glm::vec2& loc) 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;
|
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 code_lines = split(code, '\n');
|
||||||
auto error_lines = split(msg, '\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["vertex"] = SHADER_VERSION + *sections["vertex"];
|
||||||
*sections["fragment"] = SHADER_VERSION + *sections["fragment"];
|
*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;
|
m_path = path;
|
||||||
return true;
|
return true;
|
||||||
@@ -152,10 +152,10 @@ bool Shader::reload()
|
|||||||
return false;
|
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;
|
bool ret = true;
|
||||||
App::I->render_task([&]
|
App::I->render_task([this, &ret, vertex, fragment]
|
||||||
{
|
{
|
||||||
GLint status;
|
GLint status;
|
||||||
static char infolog[4096];
|
static char infolog[4096];
|
||||||
@@ -168,7 +168,7 @@ bool Shader::create(const char* vertex, const char* fragment)
|
|||||||
ret = false;
|
ret = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
source = vertex;
|
source = vertex.c_str();
|
||||||
glShaderSource(vs, 1, &source, nullptr);
|
glShaderSource(vs, 1, &source, nullptr);
|
||||||
glCompileShader(vs);
|
glCompileShader(vs);
|
||||||
glGetShaderiv(vs, GL_COMPILE_STATUS, &status);
|
glGetShaderiv(vs, GL_COMPILE_STATUS, &status);
|
||||||
@@ -192,7 +192,7 @@ bool Shader::create(const char* vertex, const char* fragment)
|
|||||||
ret = false;
|
ret = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
source = fragment;
|
source = fragment.c_str();
|
||||||
glShaderSource(fs, 1, &source, nullptr);
|
glShaderSource(fs, 1, &source, nullptr);
|
||||||
glCompileShader(fs);
|
glCompileShader(fs);
|
||||||
glGetShaderiv(fs, GL_COMPILE_STATUS, &status);
|
glGetShaderiv(fs, GL_COMPILE_STATUS, &status);
|
||||||
@@ -256,14 +256,18 @@ bool Shader::create(const char* vertex, const char* fragment)
|
|||||||
GLint count;
|
GLint count;
|
||||||
GLint size; // size of the variable
|
GLint size; // size of the variable
|
||||||
GLenum type; // type of the variable (float, vec3 or mat4, etc)
|
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
|
GLchar name[bufSize]; // variable name in GLSL
|
||||||
GLsizei length; // name length
|
GLsizei length; // name length
|
||||||
glGetProgramiv(ps, GL_ACTIVE_UNIFORMS, &count);
|
glGetProgramiv(ps, GL_ACTIVE_UNIFORMS, &count);
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
glGetActiveUniform(ps, (GLuint)i, bufSize, &length, &size, &type, name);
|
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));
|
//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
|
else
|
||||||
glUniform1i(m_umap[id], i);
|
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)
|
void Shader::u_float(kShaderUniform id, float f)
|
||||||
{
|
{
|
||||||
if (m_umap.count(id) == 0)
|
if (m_umap.count(id) == 0)
|
||||||
@@ -350,7 +358,7 @@ bool ShaderManager::reload()
|
|||||||
return success;
|
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;
|
m_shaders[id].name = id;
|
||||||
return m_shaders[id].create(vertex, fragment);
|
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);
|
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)
|
Shader* ShaderManager::get(kShader id)
|
||||||
{
|
{
|
||||||
auto it = m_shaders.find(id);
|
auto it = m_shaders.find(id);
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ class Shader
|
|||||||
std::string read(const std::string& path);
|
std::string read(const std::string& path);
|
||||||
public:
|
public:
|
||||||
kShader name;
|
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 load(const std::string& path);
|
||||||
bool reload();
|
bool reload();
|
||||||
bool create(const char* vertex, const char* fragment);
|
bool create(const std::string& vertex, const std::string& fragment);
|
||||||
void destroy();
|
void destroy();
|
||||||
void use();
|
void use();
|
||||||
void u_vec4(kShaderUniform id, const glm::vec4& v);
|
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_vec2(kShaderUniform id, const glm::vec2& v);
|
||||||
void u_mat4(kShaderUniform id, const glm::mat4& m);
|
void u_mat4(kShaderUniform id, const glm::mat4& m);
|
||||||
void u_int(kShaderUniform id, int i);
|
void u_int(kShaderUniform id, int i);
|
||||||
|
void u_int(const char* name, int i);
|
||||||
void u_float(kShaderUniform id, float f);
|
void u_float(kShaderUniform id, float f);
|
||||||
GLint GetAttribLocation(const char* name);
|
GLint GetAttribLocation(const char* name);
|
||||||
};
|
};
|
||||||
@@ -111,7 +112,7 @@ public:
|
|||||||
static bool ext_framebuffer_fetch;
|
static bool ext_framebuffer_fetch;
|
||||||
static bool load(kShader id, const std::string& path);
|
static bool load(kShader id, const std::string& path);
|
||||||
static bool reload();
|
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(kShader id);
|
||||||
static void use(const char* name);
|
static void use(const char* name);
|
||||||
static Shader* get(kShader id);
|
static Shader* get(kShader id);
|
||||||
@@ -120,6 +121,7 @@ public:
|
|||||||
static void u_vec2(kShaderUniform id, const glm::vec2& v);
|
static void u_vec2(kShaderUniform id, const glm::vec2& v);
|
||||||
static void u_mat4(kShaderUniform id, const glm::mat4& m);
|
static void u_mat4(kShaderUniform id, const glm::mat4& m);
|
||||||
static void u_int(kShaderUniform id, int i);
|
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 u_float(kShaderUniform id, float f);
|
||||||
static void invalidate();
|
static void invalidate();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user