-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed premultiplied alpha. Added circle example.
- Loading branch information
1 parent
cdbaf80
commit c991a44
Showing
9 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: "default" | ||
scale_along_z: 0 | ||
embedded_instances { | ||
id: "canvas" | ||
data: "components {\n" | ||
" id: \"circle\"\n" | ||
" component: \"/examples/circle/circle.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"embedded_components {\n" | ||
" id: \"sprite\"\n" | ||
" type: \"sprite\"\n" | ||
" data: \"tile_set: \\\"/examples/full.atlas\\\"\\n" | ||
"default_animation: \\\"fullscreen512\\\"\\n" | ||
"material: \\\"/examples/sprite.material\\\"\\n" | ||
"blend_mode: BLEND_MODE_ALPHA\\n" | ||
"\"\n" | ||
" position {\n" | ||
" x: 8.572\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 248.0 | ||
y: 500.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function init(self) | ||
msg.post("@render:", "clear_color", {color = vmath.vector4(1, 0, 0, 1)}) | ||
-- size of texture when scaled to nearest power of two | ||
local width = 64 | ||
local height = 64 | ||
local channels = 4 | ||
|
||
self.resource_path = go.get("#sprite", "texture0") | ||
|
||
self.buffer_info = { | ||
buffer = buffer.create(width * height, {{name = hash("rgba"), type = buffer.VALUE_TYPE_UINT8, count = channels}}), | ||
width = width, | ||
height = height, | ||
channels = channels, | ||
premultiply_alpha = true | ||
} | ||
|
||
self.header = {width = width, height = height, type = resource.TEXTURE_TYPE_2D, format = resource.TEXTURE_FORMAT_RGBA, num_mip_maps = 1} | ||
drawpixels.fill(self.buffer_info, 0, 0, 0, 0) | ||
|
||
drawpixels.circle(self.buffer_info, width * 0.5, width * 0.5, width * 0.9, 0, 0, 255, 255, true) | ||
|
||
resource.set_texture(self.resource_path, self.header, self.buffer_info.buffer) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters