mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Improvement to light blending (can mix sunlight to transparent and luminous tile), failed attempt to perturb terrain, need better algorithm
Former-commit-id: a8b456401859802fe5d19b7d12a41033f2ed3e44 Former-commit-id: 4f4a976e6f295f45519744216704c864afb6d621
This commit is contained in:
30
work_files/Tools/b24_col_to_40step_col.py
Normal file
30
work_files/Tools/b24_col_to_40step_col.py
Normal file
@@ -0,0 +1,30 @@
|
||||
MUL = 40
|
||||
MUL_2 = MUL ** 2
|
||||
MAX_STEP = MUL - 1
|
||||
|
||||
def getch(eightbit):
|
||||
return int(round(eightbit / 255.0 * MAX_STEP))
|
||||
|
||||
|
||||
def getR(rgb24):
|
||||
return (rgb24 >> 16) & 0xFF
|
||||
def getG(rgb24):
|
||||
return (rgb24 >> 8) & 0xFF
|
||||
def getB(rgb24):
|
||||
return rgb24 & 0xFF
|
||||
|
||||
|
||||
def getR40(raw):
|
||||
return raw / MUL_2
|
||||
def getG40(raw):
|
||||
return (raw % MUL_2) / MUL
|
||||
def getB40(raw):
|
||||
return raw % MUL
|
||||
|
||||
|
||||
def intFromCol(r, g, b):
|
||||
return r * MUL_2 + g * MUL + b
|
||||
def colFromNum(raw):
|
||||
return getR40(raw), getG40(raw), getB40(raw)
|
||||
|
||||
print(intFromCol(19,39,0))
|
||||
21
work_files/Tools/img_12bit_raw.py
Normal file
21
work_files/Tools/img_12bit_raw.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# usage: pypy scriptname inputfile outputfile
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def bandlimit(i):
|
||||
key = (i & 0xF0) >> 4
|
||||
return (key << 4) | key
|
||||
|
||||
|
||||
outcontents = []
|
||||
|
||||
infile = open(sys.argv[1], "rb").read()
|
||||
|
||||
for i in infile:
|
||||
#print(ord(i))
|
||||
outcontents.append(bandlimit(ord(i)))
|
||||
|
||||
outfile = open(sys.argv[2], "wb")
|
||||
outfile.write(bytearray(outcontents))
|
||||
outfile.close()
|
||||
Reference in New Issue
Block a user