Rename sticker to decal

This commit is contained in:
luboslenco
2019-02-26 13:35:58 +01:00
parent dd0d354ba9
commit cb2c707b13
6 changed files with 23 additions and 23 deletions
+4 -4
View File
@@ -106,8 +106,8 @@ class App extends iron.Trait {
// Draw material preview
if (UITrait.inst != null && UITrait.inst.materialPreview) return 100;
// Drawing sticker preview
if (UITrait.inst != null && UITrait.inst.stickerPreview) return 512;
// Drawing decal preview
if (UITrait.inst != null && UITrait.inst.decalPreview) return 512;
var res = 0;
if (UINodes.inst == null || UITrait.inst == null) {
@@ -132,8 +132,8 @@ class App extends iron.Trait {
// Draw material preview
if (UITrait.inst != null && UITrait.inst.materialPreview) return 100;
// Drawing sticker preview
if (UITrait.inst != null && UITrait.inst.stickerPreview) return 512;
// Drawing decal preview
if (UITrait.inst != null && UITrait.inst.decalPreview) return 512;
var res = 0;
res = kha.System.windowHeight();
+2 -2
View File
@@ -134,7 +134,7 @@ class MaterialBuilder {
frag.write('if (sp.z > textureLod(paintdb, vec2(sp.x, bsp.y), 0).r) { discard; }');
#end
if (UITrait.inst.brushPaint == 2) { // Sticker
if (UITrait.inst.brushPaint == 2) { // Decal
frag.write('float dist = 0.0;');
}
else {
@@ -210,7 +210,7 @@ class MaterialBuilder {
frag.add_uniform('float brushScale', '_brushScale');
frag.write_attrib('vec2 uvsp = sp.xy;');
// Sticker
// Decal
if (UITrait.inst.brushPaint == 2) {
frag.write_attrib('vec2 binp = inp.xy * 2.0 - 1.0;');
+6 -6
View File
@@ -4,11 +4,11 @@ import iron.object.MeshObject;
import iron.math.Mat4;
class RenderUtil {
public static function makeStickerPreview() {
if (UITrait.inst.stickerImage == null) {
UITrait.inst.stickerImage = kha.Image.createRenderTarget(512, 512);
public static function makeDecalPreview() {
if (UITrait.inst.decalImage == null) {
UITrait.inst.decalImage = kha.Image.createRenderTarget(512, 512);
}
UITrait.inst.stickerPreview = true;
UITrait.inst.decalPreview = true;
var painto = UITrait.inst.paintObject;
for (p in UITrait.inst.paintObjects) p.visible = false;
@@ -35,11 +35,11 @@ class RenderUtil {
iron.Scene.active.camera.buildMatrix();
UINodes.inst.parseMeshPreviewMaterial();
iron.RenderPath.active.commands = arm.renderpath.RenderPathDeferred.commandsSticker;
iron.RenderPath.active.commands = arm.renderpath.RenderPathDeferred.commandsDecal;
iron.RenderPath.active.renderFrame(iron.RenderPath.active.frameG);
iron.RenderPath.active.commands = arm.renderpath.RenderPathDeferred.commands;
UITrait.inst.stickerPreview = false;
UITrait.inst.decalPreview = false;
@:privateAccess iron.RenderPath.active.lastW = iron.App.w();
@:privateAccess iron.RenderPath.active.lastH = iron.App.h();
+1 -1
View File
@@ -191,7 +191,7 @@ class UINodes extends iron.Trait {
parsePaintMaterial();
RenderUtil.makeMaterialPreview();
UITrait.inst.hwnd.redraws = 2;
if (UITrait.inst.brushPaint == 2) RenderUtil.makeStickerPreview();
if (UITrait.inst.brushPaint == 2) RenderUtil.makeDecalPreview();
}
}
else if (ui.changed && (mstartedlast || mouse.moved) && UITrait.inst.instantMat) {
+8 -8
View File
@@ -98,8 +98,8 @@ class UITrait extends iron.Trait {
public var selectedLayer:LayerSlot;
var selectTime = 0.0;
public var displaceStrength = 1.0;
public var stickerImage:kha.Image = null;
public var stickerPreview = false;
public var decalImage:kha.Image = null;
public var decalPreview = false;
public var viewportMode = 0;
public var instantMat = true;
var hscaleWasChanged = false;
@@ -863,11 +863,11 @@ class UITrait extends iron.Trait {
var psize = Std.int(cursorImg.width * (brushRadius * brushNodesRadius));
if (brushPaint == 2) { // Sticker
if (brushPaint == 2) { // Decal
if (mouse.x > 0 && mx < iron.App.w()) {
// var psize = Std.int(stickerImage.width * (brushRadius * brushNodesRadius));
// var psize = Std.int(decalImage.width * (brushRadius * brushNodesRadius));
psize = Std.int(256 * (brushRadius * brushNodesRadius));
g.drawScaledImage(stickerImage, mx - psize / 2, my - psize / 2 + psize, psize, -psize);
g.drawScaledImage(decalImage, mx - psize / 2, my - psize / 2 + psize, psize, -psize);
}
}
else {
@@ -1035,12 +1035,12 @@ class UITrait extends iron.Trait {
ui.combo(Id.handle(), ["Add"], "Blending");
var paintHandle = Id.handle();
brushPaint = ui.combo(paintHandle, ["UV Map", "Project", "Sticker"], "TexCoord");
brushPaint = ui.combo(paintHandle, ["UV Map", "Project", "Decal"], "TexCoord");
if (paintHandle.changed) {
UINodes.inst.parsePaintMaterial();
if (brushPaint == 2) { // Sticker
if (brushPaint == 2) { // Decal
ui.g.end();
RenderUtil.makeStickerPreview();
RenderUtil.makeDecalPreview();
ui.g.begin(false);
}
}
+2 -2
View File
@@ -946,7 +946,7 @@ class RenderPathDeferred {
}
@:access(iron.RenderPath)
public static function commandsSticker() {
public static function commandsDecal() {
#if rp_gbuffer2
{
@@ -992,7 +992,7 @@ class RenderPathDeferred {
var framebuffer = "texpreview";
iron.RenderPath.active.renderTargets.get("texpreview").image = arm.UITrait.inst.stickerImage;
iron.RenderPath.active.renderTargets.get("texpreview").image = arm.UITrait.inst.decalImage;
#if ((rp_antialiasing == "Off") || (rp_antialiasing == "FXAA") || (!rp_render_to_texture))
{