[Mod] Image Loader [0.1.0] [imageloader]

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Image Loader [0.1.0] [imageloader]

by Sokomine » Post

kaeza wrote: which translates to C:\whatever\minetest\mods\foo/bar.lua
...unless the mod deliberately searches for the slashes in order to act as a file browser. Lua just doesn't seem to be very consistent here. If all you're doing is loading some files with dofile, it's not relevant. But the pahts are just not the way they might be expected.
A list of my mods can be found here.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Image Loader [0.1.0] [imageloader]

by kaeza » Post

If you need to manipulate paths, feel free to implement all the functionality required. In this particular case, the question was whether or not this mod would work under Windows, citing an unfounded fear that it might cause problems due to different directory separators. The C lib under windows (MSVCRT) supports using forward slashes as separators, so why should I concern myself with these details? It makes the code portable to all platforms currently supported by minetest. If it ever causes problems, it will be fixed. Until then, no more discussion on this subject from my part.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
bobomb
Member
Posts: 162
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: [Mod] Image Loader [0.1.0] [imageloader]

by bobomb » Post

inspired by this mod I wanted to show some work I did today on the realterrain mod, now allowing you to map a greyscale image as a heightmap and the same image in color as a color overlay. this map is 640x480
Image
while the intent is to overlay satellite imagery onto elevation maps, it is fun for this kind of thing.
of course realterrain requires a lot of external libraries... and introduces 216 new textures to accomplish this.

viewtopic.php?f=9&t=12666

User avatar
lordfingle
Member
Posts: 65
Joined: Sat Apr 04, 2015 09:21
GitHub: eidy
IRC: lordfingle
In-game: lordfingle
Location: Australia
Contact:

Re: [Mod] Image Loader [0.1.0] [imageloader]

by lordfingle » Post

Image
Image
Image

If you'd like to create load images vertically instead of flat on the ground, change this routine in imageloader.lua:

Code: Select all

function imageloader.to_schematic(bmp, pal)
	local data = { }
	local datai = 1
	for y = bmp.h, 1, -1 do
		for x = 1, bmp.w do
			local c = bmp.pixels[y][bmp.w + 1 - x]
			local i = palette.bestfit_color(pal, c)
			if (i == 1) and ((c.r ~= 255) or (c.g ~= 0) or (c.r ~= 255)) then
				print("WARNING: wrong color taken as transparency:"
					..(("at (%d,%d): [R=%d,G=%d,B=%d]"):format(x, y, c.r, c.g, c.b))
				)
			end
			local node = pal[i].node
			data[datai] = { name=node }
			datai = datai + 1
		end
	end
	return {
		size = { x=bmp.w, y=bmp.h, z=1 },
		data = data,
	}
end
Attachments
trump.png
trump.png (147.39 KiB) Viewed 361 times
bottle.png
bottle.png (31.75 KiB) Viewed 360 times
theeye.png
theeye.png (116.01 KiB) Viewed 360 times
----------------------------------------------------------------------------------------------
Team Lead on "eidy- Love learning"
I like reading, walks on the beach and building edutech experiences in lua (Find out more in this post)
"Coming together is a beginning; keeping together is progress; working together is success." - Henry Ford

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Image Loader [0.1.0] [imageloader]

by azekill_DIABLO » Post

great! but we need a better color render :/
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 11 guests