mirror of https://github.com/axmolengine/axmol.git
Migrate materials
This commit is contained in:
parent
c675e15a92
commit
5a0838e52b
|
@ -74,6 +74,7 @@ static bool isValidUniform(const char* name);
|
||||||
|
|
||||||
Material* Material::createWithFilename(std::string_view filepath)
|
Material* Material::createWithFilename(std::string_view filepath)
|
||||||
{
|
{
|
||||||
|
AXLOG("Loading material: %s", filepath.data());
|
||||||
auto validfilename = FileUtils::getInstance()->fullPathForFilename(filepath);
|
auto validfilename = FileUtils::getInstance()->fullPathForFilename(filepath);
|
||||||
if (!validfilename.empty())
|
if (!validfilename.empty())
|
||||||
{
|
{
|
||||||
|
@ -377,10 +378,11 @@ bool Material::parseShader(Pass* pass, Properties* shaderProperties)
|
||||||
auto vertShaderSrc = fu->getStringFromFile(vertShader);
|
auto vertShaderSrc = fu->getStringFromFile(vertShader);
|
||||||
auto fragShaderSrc = fu->getStringFromFile(fragShader);
|
auto fragShaderSrc = fu->getStringFromFile(fragShader);
|
||||||
|
|
||||||
auto defs = replaceDefines(compileTimeDefines);
|
//since axmol-1.1 no longer support compile time defines
|
||||||
|
//auto defs = replaceDefines(compileTimeDefines);
|
||||||
|
|
||||||
vertShaderSrc = defs + "\n" + vertShaderSrc;
|
//vertShaderSrc = defs + "\n" + vertShaderSrc;
|
||||||
fragShaderSrc = defs + "\n" + fragShaderSrc;
|
//fragShaderSrc = defs + "\n" + fragShaderSrc;
|
||||||
|
|
||||||
auto* program = backend::Device::getInstance()->newProgram(vertShaderSrc, fragShaderSrc);
|
auto* program = backend::Device::getInstance()->newProgram(vertShaderSrc, fragShaderSrc);
|
||||||
auto programState = new backend::ProgramState(program);
|
auto programState = new backend::ProgramState(program);
|
||||||
|
|
Loading…
Reference in New Issue