Skip to content

Commit

Permalink
Removed all postprocessing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Richardn2002 committed Apr 6, 2023
1 parent 19e9132 commit afea839
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 239 deletions.
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,30 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


BSD 2-Clause License

Copyright (c) 2023, Noeme2D Workgroup
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 changes: 8 additions & 11 deletions shaders/basic/basic.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@
Authors: Luna Nielsen
*/

/*
Inochi2D OpenGL ES 2.0 Port
Copyright © 2023, Noeme2D Workgroup
Distributed under the 2-Clause BSD License, see LICENSE file.
Authors: Leo Li, Ruiqi Niu
*/
#version 330
in vec2 texUVs;

layout(location = 0) out vec4 outAlbedo;
layout(location = 1) out vec4 outEmissive;
layout(location = 2) out vec4 outBump;

uniform sampler2D albedo;
uniform sampler2D emissive;
uniform sampler2D bumpmap;

uniform float opacity;
uniform vec3 multColor;
uniform vec3 screenColor;
uniform float emissionStrength = 1;

void main() {
// Sample texture
Expand All @@ -29,10 +32,4 @@ void main() {

// Multiply color math + opacity application.
outAlbedo = vec4(screenOut.xyz, texColor.a) * vec4(multColor.xyz, 1) * opacity;

// Emissive
outEmissive = vec4(texture(emissive, texUVs).xyz*emissionStrength, 1) * outAlbedo.a;

// Bumpmap
outBump = vec4(texture(bumpmap, texUVs).xyz, 1) * outAlbedo.a;
}
18 changes: 8 additions & 10 deletions shaders/basic/composite.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
Authors: Luna Nielsen
*/

/*
Inochi2D OpenGL ES 2.0 Port
Copyright © 2023, Noeme2D Workgroup
Distributed under the 2-Clause BSD License, see LICENSE file.
Authors: Leo Li, Ruiqi Niu
*/
#version 330
in vec2 texUVs;

layout(location = 0) out vec4 outAlbedo;
layout(location = 1) out vec4 outEmissive;
layout(location = 2) out vec4 outBump;

uniform sampler2D albedo;
uniform sampler2D emissive;
uniform sampler2D bumpmap;

uniform float opacity;
uniform vec3 multColor;
Expand All @@ -28,10 +32,4 @@ void main() {

// Multiply color math + opacity application.
outAlbedo = vec4(screenOut.xyz, texColor.a) * vec4(multColor.xyz, 1) * opacity;

// Emissive
outEmissive = texture(emissive, texUVs) * outAlbedo.a;

// Bumpmap
outBump = texture(bumpmap, texUVs) * outAlbedo.a;
}
53 changes: 0 additions & 53 deletions shaders/lighting.frag

This file was deleted.

10 changes: 8 additions & 2 deletions source/inochi2d/core/nodes/composite/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
Authors: Luna Nielsen
*/

/*
Inochi2D OpenGL ES 2.0 Port
Copyright © 2023, Noeme2D Workgroup
Distributed under the 2-Clause BSD License, see LICENSE file.
Authors: Leo Li, Ruiqi Niu
*/
module inochi2d.core.nodes.composite;
import inochi2d.core.nodes.common;
import inochi2d.core.nodes;
Expand Down Expand Up @@ -45,8 +53,6 @@ package(inochi2d) {
gMultColor = cShader.getUniformLocation("multColor");
gScreenColor = cShader.getUniformLocation("screenColor");
cShader.setUniform(cShader.getUniformLocation("albedo"), 0);
cShader.setUniform(cShader.getUniformLocation("emissive"), 1);
cShader.setUniform(cShader.getUniformLocation("bumpmap"), 2);

cShaderMask = new Shader(
import("basic/composite.vert"),
Expand Down
16 changes: 8 additions & 8 deletions source/inochi2d/core/nodes/part/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
Authors: Luna Nielsen
*/

/*
Inochi2D OpenGL ES 2.0 Port
Copyright © 2023, Noeme2D Workgroup
Distributed under the 2-Clause BSD License, see LICENSE file.
Authors: Leo Li, Ruiqi Niu
*/
module inochi2d.core.nodes.part;
import inochi2d.integration;
import inochi2d.fmt;
Expand Down Expand Up @@ -56,19 +64,14 @@ package(inochi2d) {

partShader.use();
partShader.setUniform(partShader.getUniformLocation("albedo"), 0);
partShader.setUniform(partShader.getUniformLocation("emissive"), 1);
partShader.setUniform(partShader.getUniformLocation("bumpmap"), 2);
mvp = partShader.getUniformLocation("mvp");
offset = partShader.getUniformLocation("offset");
gopacity = partShader.getUniformLocation("opacity");
gMultColor = partShader.getUniformLocation("multColor");
gScreenColor = partShader.getUniformLocation("screenColor");
gEmissionStrength = partShader.getUniformLocation("emissionStrength");

partMaskShader.use();
partMaskShader.setUniform(partMaskShader.getUniformLocation("albedo"), 0);
partMaskShader.setUniform(partMaskShader.getUniformLocation("emissive"), 1);
partMaskShader.setUniform(partMaskShader.getUniformLocation("bumpmap"), 2);
mmvp = partMaskShader.getUniformLocation("mvp");
mthreshold = partMaskShader.getUniformLocation("threshold");

Expand Down Expand Up @@ -175,11 +178,8 @@ private:
partShader.setUniform(offset, data.origin);
partShader.setUniform(mvp, inGetCamera().matrix * transform.matrix());
partShader.setUniform(gopacity, clamp(offsetOpacity * opacity, 0, 1));
partShader.setUniform(gEmissionStrength, emissionStrength*offsetEmissionStrength);

partShader.setUniform(partShader.getUniformLocation("albedo"), 0);
partShader.setUniform(partShader.getUniformLocation("emissive"), 1);
partShader.setUniform(partShader.getUniformLocation("bumpmap"), 2);

vec3 clampedColor = tint;
if (!offsetTint.x.isNaN) clampedColor.x = clamp(tint.x*offsetTint.x, 0, 1);
Expand Down
Loading

0 comments on commit afea839

Please sign in to comment.