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(); }
public LCC3Vector4 TransformCC3Vector4(LCC3Vector4 vec4) { return new LCC3Vector4(Vector4.Transform(vec4.XnaVector4, _xnaMatrix)); }
public void SetLocation(LCC3Vector location, uint index) { switch(this.ElementSize) { case 2: _vertices[index] = new CCPoint(location.X, location.Y); break; case 4: _vertices[index] = new LCC3Vector4(location, 1.0f); break; default: _vertices[index] = location; break; } this.MarkBoundaryDirty(); }
public void SetHomogeneousLocation(LCC3Vector4 location, uint index) { switch(this.ElementSize) { case 2: _vertices[index] = new CCPoint(location.X, location.Y); break; case 3: _vertices[index] = location.TruncateToCC3Vector(); break; default: _vertices[index] = location; break; } }
public LCC3Vector4 HomogeneousLocationAt(uint index) { LCC3Vector4 location = (LCC3Vector4)_vertices[(int)index]; float newZ = location.Z; float newW = location.W; switch(this.ElementSize) { case 2: newZ = 0.0f; newW = 1.0f; break; case 3: newW = 1.0f; break; default: break; } location = new LCC3Vector4(location.X, location.Y, newZ, newW); return location; }
private void UpdateGlobalLocation() { LCC3Vector4 locVec4 = new LCC3Vector4(_location, 0.0f); _globalLocation = _transformMatrix.TransformCC3Vector4(locVec4).TruncateToCC3Vector(); }