Example #1
0
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
Example #2
0
 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)
Example #3
0
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
Example #4
0
 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)
Example #5
0
 def build_project(self):
     cwd = os.getcwd()
     os.chdir(self.build_dir)
     call([MAKE_PATH, '-j4'])
     os.chdir(cwd)