Giter Site home page Giter Site logo

isogen's Introduction

isogen

License Download Coverage Status

Generate isometric images from ingame builds

Commands

If the worldedit mod is present you can use the following command to render the current we-region to a png-file:

//isogen [filename]

NOTE: larger regions require more memory

Colors

Supported node-colors:

  • colors.txt files in the /colors directory
  • palette-support for unifieddyes_palette_extended
  • mapcolor node definition
  • colors.txt file in the world-directory (if found)

Api

isogen.draw(pos1, pos2, opts?)

Renders an isometric image and returns the png data

Example:

local pos1 = vector.new(0,0,0)
local pos2 = vector.new(16,16,16) -- NOTE: larger regions require more memory
local opts = { -- optional
    cube_len = 24, -- optional: multiple of 4 and greater than 4 pixels
    enable_transparency = false, -- optional/experimental: enable transparency
    get_node = minetest.get_node -- optional: the get_node() function to use
}

-- render and save to world-directory
local png = isogen.draw(pos1, pos2, opts)
local path = minetest.get_worldpath() .. "/iso.png"
minetest.safe_file_write(path, png)

isogen.draw_map(pos1, pos2, opts?)

Renders a map image and returns the png data

Example:

local pos1 = vector.new(0,0,0)
local pos2 = vector.new(16,16,16) -- NOTE: larger regions require more memory
local opts = { -- optional
    get_node = minetest.get_node -- optional: the get_node() function to use
}

-- render and save to world-directory
local png = isogen.draw_map(pos1, pos2, opts)
local path = minetest.get_worldpath() .. "/map.png"
minetest.safe_file_write(path, png)

isogen.create_canvas(width, height)

Creates a canvas to set and get pixels

Example:

-- create a canvas, draw a pixel on the coords 0,0 and save the png to the world-directory
local c = isogen.create_canvas(240, 160)
c:set_pixel(0, 0, { r=255, g=0, b=0, a=0 })

local png = c:png()
local path = minetest.get_worldpath() .. "/iso.png"
minetest.safe_file_write(path, png)

License

  • Code: MIT

isogen's People

Contributors

buckaroobanzay avatar

Stargazers

 avatar  avatar Niklp avatar

Watchers

 avatar

isogen's Issues

async support?

writing the png would be a good candidate for an async job. If the area is small enough, then just serialize the map data and send it to the async enviroment to create the image. If the area is too large, then break it up into smaller chunks, serialize those, process them individually in async, and then process the individually-returned images into a large image.

Server crash

This is the log

2024-06-05 22:49:13: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'isogen' in callback on_chat_message(): ...minetest/bin/../mods/isogen/draw.lua:15: attempt to perform arithmetic on field 'r' (a nil value)
2024-06-05 22:49:13: ERROR[Main]: stack traceback:
2024-06-05 22:49:13: ERROR[Main]: ...minetest/bin/../mods/isogen/draw.lua:15: in function 'color_adjust'
2024-06-05 22:49:13: ERROR[Main]: ...minetest/bin/../mods/isogen/draw.lua:66: in function 'draw'
2024-06-05 22:49:13: ERROR[Main]: ...minetest/bin/../mods/isogen/chatcommand.lua:17: in function 'func'
2024-06-05 22:49:13: ERROR[Main]: ...n/../mods/Minetest-WorldEdit/worldedit_commands/init.lua:53: in function 'run'
2024-06-05 22:49:13: ERROR[Main]: ...n/../mods/Minetest-WorldEdit/worldedit_commands/init.lua:61: in function 'func'
2024-06-05 22:49:13: ERROR[Main]: ...minetest/bin/../builtin/game/chat.lua:79: in function <...minetest/bin/../builtin/game/chat.lua:52>
2024-06-05 22:49:13: ERROR[Main]: ...minetest/bin/../builtin/common/register.lua:26: in function <...minetest/bin/../builtin/common/register.lua:12>

top-down view

A top-down version would be great for making custom minigame minimaps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.