beginning migrate to shaders

add a few submodules
generate C file store with cfs_gen
remove FileLoader/TextureLoader
add initial color shaders for wfobj objects
This commit is contained in:
Josh Holtrop committed 2011-05-18 17:17:06 -04:00
1 parent 55fee6b9a9
commit 8028654ff2
21 files changed
+101 -1250

No files matched your search

+26 -25
View File
@@ -16,7 +16,6 @@ if os.sep == '\\':
platform = 'PLATFORM_WINDOWS'
else:
platform = 'PLATFORM_LINUX'
subdirs = ['WFObj', 'PhyObj', 'TextureCache', 'OdeWorld']
env = Environment()
env.ParseConfig('pkg-config --cflags --libs lua5.1')
@@ -37,38 +36,40 @@ env.Append(CCFLAGS = ['-O2', '-Wall'])
if DEBUG:
env.Append(CCFLAGS = ['-g'])
sources = [Glob('src/*.cc'), 'ag_lua.cc', 'sdl_keymap.cc']
for sd in subdirs:
sources += [Glob(sd + '/*.c'), Glob(sd + '/*.cc')]
sources = [
'cfs.cc',
'sdl_keymap.cc',
Glob('src/*.cc'),
'OdeWorld/OdeWorld.cc',
'PhyObj/PhyObj.cc',
'TextureCache/TextureCache.cc',
'wfobj/WFObj.cc',
]
def F2C(target, source, env):
f = open(str(target[0]), 'w')
def CFS(target, source, env):
source_list = []
for s in source:
c_name = re.sub(r'\W', '_', str(s).split('/')[-1])
f.write('unsigned char %s[] = {' % c_name)
src = open(str(s), 'r')
s_len = 0
while 1:
if s_len % 12 == 0:
f.write('\n ')
ch = src.read(1)
if len(ch) < 1:
break
s_len += 1
f.write('0x%02x, ' % ord(ch))
f.write('0x00\n')
src.close()
f.write('};\n')
f.write('unsigned int %s_len = %d;\n' % (c_name, s_len))
f.close()
source_list.append(str(s))
Popen(['./cfs_gen/cfs_gen.py', str(target[0])] + source_list).wait()
return None
def CFS_emitter(target, source, env):
target.append(re.sub(r'\.cc?', '.h', str(target[0])))
return target, source
def bt(cmd):
return Popen(cmd, shell = True, stdout = PIPE).communicate()[0]
env.Append(BUILDERS = {'F2C' : Builder(action = F2C)})
env.Append(BUILDERS = {'CFS' : Builder(action = CFS, emitter = CFS_emitter)})
env.F2C('ag_lua.cc', 'src/ag.lua')
cfs_sources = [
'src/ag.lua',
'shaders/wfobj.f.glsl',
'shaders/wfobj.v.glsl',
]
env.CFS('cfs.cc', cfs_sources)
env.Depends('cfs.cc', 'cfs_gen/cfs_gen.py')
env.Command('sdl_keymap.cc', 'gen-sdl-keymap.pl', 'perl gen-sdl-keymap.pl')
env.Program(target, sources)