| 45 | const char* defaultMaterialFragmentShader = "fragment/sample_diffuse_no_texture.cg"; |
| 46 | |
| 47 | RenderMaterial::RenderMaterial(Renderer& renderer, const PxVec3& diffuseColor, PxReal opacity, bool doubleSided, PxU32 id, RenderTexture* texture, bool lit, bool flat, bool instanced) : |
| 48 | mRenderMaterial (NULL), |
| 49 | mRenderMaterialInstance (NULL), |
| 50 | mID (id), |
| 51 | mDoubleSided (doubleSided), |
| 52 | mOwnsRendererMaterial (true) |
| 53 | { |
| 54 | RendererMaterialDesc matDesc; |
| 55 | if(lit) |
| 56 | matDesc.type = RendererMaterial::TYPE_LIT; |
| 57 | else |
| 58 | matDesc.type = RendererMaterial::TYPE_UNLIT; |
| 59 | matDesc.alphaTestFunc = RendererMaterial::ALPHA_TEST_ALWAYS; |
| 60 | matDesc.alphaTestRef = 0.0f; |
| 61 | if(opacity==1.0f) |
| 62 | { |
| 63 | matDesc.blending = false; |
| 64 | matDesc.srcBlendFunc = RendererMaterial::BLEND_ONE; |
| 65 | matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE; |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | matDesc.type = RendererMaterial::TYPE_UNLIT; |
| 70 | matDesc.blending = true; |
| 71 | // matDesc.srcBlendFunc = RendererMaterial::BLEND_ONE; |
| 72 | // matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE; |
| 73 | matDesc.srcBlendFunc = RendererMaterial::BLEND_SRC_ALPHA; |
| 74 | matDesc.dstBlendFunc = RendererMaterial::BLEND_ONE_MINUS_SRC_ALPHA; |
| 75 | } |
| 76 | |
| 77 | if(instanced) |
| 78 | { |
| 79 | matDesc.instanced = true; |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | matDesc.instanced = false; |
| 84 | } |
| 85 | |
| 86 | matDesc.geometryShaderPath = NULL; |
| 87 | |
| 88 | matDesc.vertexShaderPath = defaultMaterialLitVertexShader; |
| 89 | |
| 90 | if(texture) |
| 91 | { |
| 92 | if(lit) |
| 93 | { |
| 94 | matDesc.fragmentShaderPath = defaultMaterialTexturedLitFragmentShader; |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | matDesc.fragmentShaderPath = defaultMaterialTexturedUnlitFragmentShader; |
| 99 | } |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | matDesc.fragmentShaderPath = defaultMaterialFragmentShader; |
| 104 | } |
nothing calls this directly
no test coverage detected