Cloud asset icon cutout
This commit is contained in:
@@ -31,6 +31,7 @@ class Layers {
|
||||
public static var pipeCopy8: PipelineState;
|
||||
public static var pipeCopy128: PipelineState;
|
||||
public static var pipeCopyBGRA: PipelineState;
|
||||
public static var pipeCopyRGB: PipelineState = null;
|
||||
public static var pipeInvert8: PipelineState;
|
||||
public static var pipeMask: PipelineState;
|
||||
public static var tex0: TextureUnit;
|
||||
@@ -218,6 +219,19 @@ class Layers {
|
||||
texaMask = pipeMask.getTextureUnit("texa");
|
||||
}
|
||||
|
||||
public static function makePipeCopyRGB() {
|
||||
pipeCopyRGB = new PipelineState();
|
||||
pipeCopyRGB.vertexShader = kha.Shaders.getVertex("layer_view.vert");
|
||||
pipeCopyRGB.fragmentShader = kha.Shaders.getFragment("layer_copy.frag");
|
||||
var vs = new VertexStructure();
|
||||
vs.add("pos", VertexData.Float3);
|
||||
vs.add("tex", VertexData.Float2);
|
||||
vs.add("col", VertexData.Float4);
|
||||
pipeCopyRGB.inputLayout = [vs];
|
||||
pipeCopyRGB.colorWriteMasksAlpha = [false];
|
||||
pipeCopyRGB.compile();
|
||||
}
|
||||
|
||||
public static function makeCursorPipe() {
|
||||
pipeCursor = new PipelineState();
|
||||
pipeCursor.vertexShader = kha.Shaders.getVertex("cursor.vert");
|
||||
|
||||
@@ -143,8 +143,17 @@ class UIFiles {
|
||||
var abs = File.cacheCloud(handle.text + Path.sep + iconFile);
|
||||
if (abs != null) {
|
||||
iron.data.Data.getImage(abs, function(image: kha.Image) {
|
||||
icon = image;
|
||||
iconMap.set(handle.text + Path.sep + f, icon);
|
||||
iron.App.notifyOnInit(function() {
|
||||
if (Layers.pipeCopyRGB == null) Layers.makePipeCopyRGB();
|
||||
icon = kha.Image.createRenderTarget(image.width, image.height);
|
||||
icon.g2.begin(false);
|
||||
icon.g2.drawImage(Project.materials[0].image, 0, 0); // Used for alpha cutout
|
||||
icon.g2.pipeline = Layers.pipeCopyRGB;
|
||||
icon.g2.drawImage(image, 0, 0);
|
||||
icon.g2.pipeline = null;
|
||||
icon.g2.end();
|
||||
iconMap.set(handle.text + Path.sep + f, icon);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user