Exemplo n.º 1
0
GpuShaderProgramID ShaderAsset::Refresh(FileLoader& loader)
{
    GpuShaderProgramID old = m_shaderProgram;

    char fullPath[SHADER_MAX_PATH_LENGTH];
    PrintFullPath(fullPath, sizeof fullPath, GetName());

    u8* data;
    u32 size;
    loader.Load(fullPath, &data, &size, Alloc, NULL);

    m_shaderProgram = m_device.ShaderProgramCreate((const char*)data, (size_t)size);

    free(data);

    m_refCountAndRefreshStatus |= REFRESH_STATUS_MASK;
    return old;
}
Exemplo n.º 2
0
ShaderAsset::ShaderAsset(GpuDevice& device, FileLoader& loader, const char* name)
    : m_link()

    , m_device(device)
    , m_shaderProgram(0)
    , m_refCountAndRefreshStatus(0)
{
    char fullPath[SHADER_MAX_PATH_LENGTH];
    PrintFullPath(fullPath, sizeof fullPath, name);

    u8* data;
    u32 size;
    loader.Load(fullPath, &data, &size, Alloc, NULL);

    m_shaderProgram = device.ShaderProgramCreate((const char*)data, (size_t)size);

    free(data);
}
Exemplo n.º 3
0
bool ScriptSys::Init()
{
	m_IDIndex = 0;
	m_MainState = lua_open();
	luaL_openlibs( m_MainState );
	m_Holder = new ScriptHolder( m_MainState );
	m_Holder->Init();
	
	BuildFuncs();

	// test, add some scripts first.
	char file[512];
	for( int i = 0; i < SCRIPT_NUM; ++ i )
	{
		sprintf( file, "scripts\\%d.lua", i + 1 );
		FileLoader loader;
		loader.Load( file, FileLoader::BINARY );
		FileLoader::RawData data = loader.GetRawData();
		m_Holder->Add( file, (char*) data.buf, data.size );
	}

	return true;
}