private void InitializeParametricMeshMaterials() { _listOfMaterials = new List<LCC3Material>(); LCC3GraphicsTexture2D crateTexData = new LCC3GraphicsTexture2D("Content/crate_map.jpg"); LCC3GraphicsTexture2D beachBallTexData = new LCC3GraphicsTexture2D("Content/beachball.jpg"); LCC3GraphicsTexture2D logoTexData = new LCC3GraphicsTexture2D("Content/logo.jpg"); LCC3Texture crateTexture = new LCC3Texture(0, "crate"); crateTexture.GraphicsTexture = crateTexData; crateTexture.TextureUnitMode = LCC3TextureUnitMode.Replace; LCC3Texture beachballTexture = new LCC3Texture(1, "beachball"); beachballTexture.GraphicsTexture = beachBallTexData; beachballTexture.TextureUnitMode = LCC3TextureUnitMode.Replace; LCC3Texture logoTexture = new LCC3Texture(1, "logo"); logoTexture.GraphicsTexture = logoTexData; logoTexture.TextureUnitMode = LCC3TextureUnitMode.Replace; LCC3Material multiTexMaterial = new LCC3Material(0, "sphereMaterial"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.2f, 0.2f, 0.2f, 0.5f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 3.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(beachballTexture); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "coneMaterial"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.1f, 0.1f, 0.1f, 0.3f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.8f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.5f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.9f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 3.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(beachballTexture); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "cubeMaterial"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(1.0f, 0.58f, 0.8f, 1.0f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.8f, 0.8f, 0.9f); multiTexMaterial.EmissionColor = new CCColor4F(0.3f, 0.4f, 0.2f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(crateTexture); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "planeMaterial"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(1.0f, 1.0f, 1.0f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(0.5f, 0.5f, 1.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.8f, 0.8f, 0.8f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(logoTexture); _listOfMaterials.Add(multiTexMaterial); }
private void InitializeMaterials() { _listOfMaterials = new List<LCC3Material>(); LCC3GraphicsTexture2D tex2D = new LCC3GraphicsTexture2D("Content/crate.jpg"); LCC3Texture tex = new LCC3Texture(0, "tex"); tex.GraphicsTexture = tex2D; tex.TextureUnitMode = LCC3TextureUnitMode.Replace; LCC3GraphicsTexture2D anotherTex2D = new LCC3GraphicsTexture2D("Content/xamarin.jpeg"); LCC3Texture tex2 = new LCC3Texture(1, "tex2"); tex2.GraphicsTexture = anotherTex2D; tex2.TextureUnitMode = LCC3TextureUnitMode.Decal; LCC3Material material = new LCC3Material(0, "Glowy"); material.ShaderProgram = _materialShaderProgram; material.AmbientColor = new CCColor4F(0.0f, 0.1f, 0.1f, 1.0f); material.DiffuseColor = new CCColor4F(0.5f, 0.5f, 1.0f, 0.5f); material.SpecularColor = new CCColor4F(1.0f, 1.0f, 0.0f, 1.0f); material.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.0f, 1.0f); material.Shininess = 1.0f; material.ShouldUseLighting = true; material.AddTexture(tex); material.AddTexture(tex2); _listOfMaterials.Add(material); material = new LCC3Material(1, "Grass"); material.ShaderProgram = _materialShaderProgram; material.AmbientColor = new CCColor4F(0.0f, 0.1f, 0.0f, 1.0f); material.DiffuseColor = new CCColor4F(0.0f, 0.2f, 0.0f, 0.2f); material.SpecularColor = new CCColor4F(0.0f, 1.0f, 0.0f, 1.0f); material.EmissionColor = new CCColor4F(0.0f, 0.1f, 0.0f, 1.0f); material.Shininess = 1.0f; material.ShouldUseLighting = true; material.AddTexture(tex); _listOfMaterials.Add(material); material = new LCC3Material(2, "Metal"); material.ShaderProgram = _materialShaderProgram; material.AmbientColor = new CCColor4F(0.0f, 0.3f, 0.9f, 1.0f); material.DiffuseColor = new CCColor4F(0.0f, 0.0f, 1.0f, 1.0f); material.SpecularColor = new CCColor4F(0.1f, 0.8f, 0.5f, 1.0f); material.EmissionColor = new CCColor4F(0.0f, 0.2f, 1.0f, 1.0f); material.Shininess = 100.0f; material.ShouldUseLighting = true; material.AddTexture(tex); _listOfMaterials.Add(material); material = new LCC3Material(3, "Watery"); material.ShaderProgram = _materialShaderProgram; material.AmbientColor = new CCColor4F(0.1f, 0.9f, 0.0f, 1.0f); material.DiffuseColor = new CCColor4F(0.9f, 0.5f, 0.9f, 0.5f); material.SpecularColor = new CCColor4F(0.0f, 0.0f, 0.9f, 1.0f); material.EmissionColor = new CCColor4F(0.1f, 0.15f, 0.15f, 1.0f); material.Shininess = 1.0f; material.ShouldUseLighting = true; material.AddTexture(tex); _listOfMaterials.Add(material); }
private void InitializeMultiTextureMaterials() { _listOfMaterials = new List<LCC3Material>(); LCC3GraphicsTexture2D crateTexData = new LCC3GraphicsTexture2D("Content/crate.jpg"); LCC3GraphicsTexture2D logoTexData = new LCC3GraphicsTexture2D("Content/logo.gif"); LCC3Texture crateTexture = new LCC3Texture(0, "crate"); crateTexture.GraphicsTexture = crateTexData; crateTexture.TextureUnitMode = LCC3TextureUnitMode.Replace; LCC3Texture logoTexture = new LCC3Texture(1, "logo"); logoTexture.GraphicsTexture = logoTexData; logoTexture.TextureUnitMode = LCC3TextureUnitMode.Blend; logoTexture.TextureUnitConstantColor = new CCColor4F(0.8f, 0.8f, 0.8f, 0.5f); LCC3Texture logoTextureDecal = new LCC3Texture(1, "logo"); logoTextureDecal.GraphicsTexture = logoTexData; logoTextureDecal.TextureUnitMode = LCC3TextureUnitMode.Decal; logoTextureDecal.TextureUnitConstantColor = new CCColor4F(0.8f, 0.8f, 0.8f, 0.5f); LCC3Texture logoTextureReplace = new LCC3Texture(1, "logo"); logoTextureReplace.GraphicsTexture = logoTexData; logoTextureReplace.TextureUnitMode = LCC3TextureUnitMode.Replace; logoTextureReplace.TextureUnitConstantColor = new CCColor4F(0.8f, 0.8f, 0.8f, 0.5f); LCC3Texture logoTextureBlendColor = new LCC3Texture(1, "logo"); logoTextureBlendColor.GraphicsTexture = logoTexData; logoTextureBlendColor.TextureUnitMode = LCC3TextureUnitMode.Blend; logoTextureBlendColor.TextureUnitConstantColor = new CCColor4F(0.8f, 0.3f, 0.3f, 0.6f); LCC3Material multiTexMaterial = new LCC3Material(0, "Multitex"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.5f, 0.1f, 0.1f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(crateTexture); multiTexMaterial.AddTexture(logoTextureReplace); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "Multitex"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.5f, 0.1f, 0.1f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(crateTexture); multiTexMaterial.AddTexture(logoTextureDecal); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "Multitex"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.5f, 0.1f, 0.1f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(crateTexture); multiTexMaterial.AddTexture(logoTexture); _listOfMaterials.Add(multiTexMaterial); multiTexMaterial = new LCC3Material(0, "Multitex"); multiTexMaterial.ShaderProgram = _materialShaderProgram; multiTexMaterial.AmbientColor = new CCColor4F(0.5f, 0.1f, 0.1f, 1.0f); multiTexMaterial.DiffuseColor = new CCColor4F(0.8f, 0.5f, 0.2f, 0.5f); multiTexMaterial.SpecularColor = new CCColor4F(1.0f, 0.6f, 0.0f, 1.0f); multiTexMaterial.EmissionColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f); multiTexMaterial.Shininess = 1.0f; multiTexMaterial.ShouldUseLighting = true; multiTexMaterial.AddTexture(crateTexture); multiTexMaterial.AddTexture(logoTextureBlendColor); _listOfMaterials.Add(multiTexMaterial); }
private void InitializeTankEffect() { _tankShader = new LCC3ShaderProgram(0, "MyShader", this, "Content/BasicEffect.ogl.mgfxo"); _tankTexture = new LCC3GraphicsTexture2D("turret_alt_diff_tex_0"); _tankShader.XnaShaderEffect.CurrentTechnique = _tankShader.XnaShaderEffect.Techniques[21]; //5 LCC3ShaderUniform textureUniform = _tankShader.UniformNamed("Texture"); textureUniform.SetValue(_tankTexture); textureUniform.UpdateShaderValue(); LCC3ShaderUniform diffuseColorUniform = _tankShader.UniformNamed("DiffuseColor"); LCC3Vector4 diffuseColor = new LCC3Vector4(1.0f, 1.0f, 1.0f, 0.4f); diffuseColorUniform.SetValue(diffuseColor); diffuseColorUniform.UpdateShaderValue(); LCC3ShaderUniform emissiveColorUniform = _tankShader.UniformNamed("EmissiveColor"); LCC3Vector emissiveColor = new LCC3Vector(0.5f, 0.5f, 0.9f); emissiveColorUniform.SetValue(emissiveColor); emissiveColorUniform.UpdateShaderValue(); LCC3ShaderUniform specularColorUniform = _tankShader.UniformNamed("SpecularColor"); LCC3Vector specularColor = new LCC3Vector(1.0f, 0.0f, 0.0f); specularColorUniform.SetValue(specularColor); specularColorUniform.UpdateShaderValue(); LCC3ShaderUniform specularPowerUniform = _tankShader.UniformNamed("SpecularPower"); float specularPower = 100.0f; specularPowerUniform.SetValue(specularPower); specularPowerUniform.UpdateShaderValue(); LCC3ShaderUniform light0DirectionUniform = _tankShader.UniformNamed("DirLight0Direction"); LCC3Vector light0Direction = (new LCC3Vector(-0.5f, -1.2f, -1.0f)).NormalizedVector(); light0DirectionUniform.SetValue(light0Direction); light0DirectionUniform.UpdateShaderValue(); LCC3ShaderUniform light0DiffuseColorUniform = _tankShader.UniformNamed("DirLight0DiffuseColor"); LCC3Vector light0DiffuseColor = new LCC3Vector(1.0f, 2.0f, 2.0f); light0DiffuseColorUniform.SetValue(light0DiffuseColor); light0DiffuseColorUniform.UpdateShaderValue(); LCC3ShaderUniform light0SpecularColorUniform = _tankShader.UniformNamed("DirLight0SpecularColor"); LCC3Vector light0SpecularColor = new LCC3Vector(1.0f, 0.0f, 0.0f); light0SpecularColorUniform.SetValue(light0SpecularColor); light0DiffuseColorUniform.UpdateShaderValue(); }