def convert(vert_data, frag_data, outdir, profile, name='out'): # state.name = name vert_data = translate_shader_data(vert_data, 'vertex', 'gles') frag_data = translate_shader_data(frag_data, 'fragment', 'gles') vert = get_shader(vert_data, 'vert', profile) frag = get_shader(frag_data, 'frag', profile, vert.vs_out) new_vert_path = os.path.join(outdir, '%s.vs' % name) new_frag_path = os.path.join(outdir, '%s.ps' % name) with open(new_vert_path, 'wb') as fp: fp.write(vert.data) with open(new_frag_path, 'wb') as fp: fp.write(frag.data) if profile == 'hlsl': call([ FXC_DIR, '/nologo', '/E', 'main', '/O3', '/T', 'vs_2_a', new_vert_path, '/Fo', new_vert_path + 'b' ]) call([ FXC_DIR, '/nologo', '/E', 'main', '/O3', '/T', 'ps_2_a', new_frag_path, '/Fo', new_frag_path + 'b' ]) return new_vert_path, new_frag_path
def create_project(self): cwd = os.getcwd() makedirs(self.build_dir) os.chdir(self.build_dir) call([CMAKE_PATH, '..', '-G', 'MinGW Makefiles', '-DCMAKE_LIBRARY_PATH:PATH=%s' % LIB_PATH]) os.chdir(cwd)
def convert(vert_data, frag_data, outdir, profile, name='out'): # state.name = name vert_data = translate_shader_data(vert_data, 'vertex', 'gles') frag_data = translate_shader_data(frag_data, 'fragment', 'gles') vert = get_shader(vert_data, 'vert', profile) frag = get_shader(frag_data, 'frag', profile, vert.vs_out) new_vert_path = os.path.join(outdir, '%s.vs' % name) new_frag_path = os.path.join(outdir, '%s.ps' % name) with open(new_vert_path, 'wb') as fp: fp.write(vert.data) with open(new_frag_path, 'wb') as fp: fp.write(frag.data) if profile == 'hlsl': call([FXC_DIR, '/nologo', '/E', 'main', '/O3', '/T', 'vs_2_a', new_vert_path, '/Fo', new_vert_path + 'b']) call([FXC_DIR, '/nologo', '/E', 'main', '/O3', '/T', 'ps_2_a', new_frag_path, '/Fo', new_frag_path + 'b']) return new_vert_path, new_frag_path
def run_project(self): cwd = os.getcwd() os.chdir(self.src_dir) exe = os.path.join(self.build_dir, 'Chowdren.exe') call([exe]) os.chdir(cwd)
def build_project(self): cwd = os.getcwd() os.chdir(self.build_dir) call([MAKE_PATH, '-j4']) os.chdir(cwd)