X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-scene-loader%2Fpublic-api%2Fshader-definition-factory.cpp;h=6f9ab4e5c65ac6cd69d6ca524312a0a8dc1bec99;hb=3699bd6bb292750152ea1a19f702a641f50c9867;hp=843fbcf6eb032f08274cce3b9292fb2298ffdffa;hpb=2ca1c3856ce848a94f54444f1014a820e91ee207;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-scene-loader/public-api/shader-definition-factory.cpp b/dali-scene-loader/public-api/shader-definition-factory.cpp index 843fbcf..6f9ab4e 100644 --- a/dali-scene-loader/public-api/shader-definition-factory.cpp +++ b/dali-scene-loader/public-api/shader-definition-factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,8 +56,6 @@ struct ResourceReceiver : IResourceReceiver } }; -const std::string PBR_SHADER_NAME = "dli_pbr"; - void RetrieveBlendShapeComponents(const std::vector& blendShapes, bool& hasPositions, bool& hasNormals, bool& hasTangents) { for(const auto& blendShape : blendShapes) @@ -72,9 +70,6 @@ uint64_t HashNode(const NodeDefinition& nodeDef, const MaterialDefinition& mater { Hash hash; - // note: could be per vertex / fragment component - in WatchViewer, these have the same name. - hash.Add(PBR_SHADER_NAME); - const bool hasTransparency = MaskMatch(materialDef.mFlags, MaterialDefinition::TRANSPARENCY); hash.Add(hasTransparency); @@ -96,6 +91,16 @@ uint64_t HashNode(const NodeDefinition& nodeDef, const MaterialDefinition& mater hash.Add("SSS"); } + if(MaskMatch(materialDef.mFlags, MaterialDefinition::OCCLUSION)) + { + hash.Add("OCCL" /*USION*/); + } + + if(MaskMatch(materialDef.mFlags, MaterialDefinition::EMISSIVE)) + { + hash.Add("EMIS" /*SIVE*/); + } + if(MaskMatch(materialDef.mFlags, MaterialDefinition::GLTF_CHANNELS)) { hash.Add("GLTF" /*_CHANNELS*/); @@ -187,8 +192,7 @@ Index ShaderDefinitionFactory::ProduceShader(const NodeDefinition& nodeDef) } ShaderDefinition shaderDef; - shaderDef.mVertexShaderPath = PBR_SHADER_NAME + ".vsh"; - shaderDef.mFragmentShaderPath = PBR_SHADER_NAME + ".fsh"; + shaderDef.mUseBuiltInShader = true; shaderDef.mRendererState = RendererState::DEPTH_TEST | RendererState::DEPTH_WRITE | RendererState::CULL_BACK; auto& materialDef = *receiver.mMaterialDef; @@ -217,7 +221,17 @@ Index ShaderDefinitionFactory::ProduceShader(const NodeDefinition& nodeDef) shaderDef.mDefines.push_back("SSS"); } - if(MaskMatch(receiver.mMaterialDef->mFlags, MaterialDefinition::GLTF_CHANNELS)) + if(MaskMatch(materialDef.mFlags, MaterialDefinition::OCCLUSION)) + { + shaderDef.mDefines.push_back("OCCLUSION"); + } + + if(MaskMatch(materialDef.mFlags, MaterialDefinition::EMISSIVE)) + { + shaderDef.mDefines.push_back("EMISSIVE"); + } + + if(MaskMatch(materialDef.mFlags, MaterialDefinition::GLTF_CHANNELS)) { shaderDef.mDefines.push_back("GLTF_CHANNELS"); }