public void Dispose() { if (_model != null) { _defaultEffect.Dispose(); _defaultEffect = null; _model = null; } }
public void SetShader(RShader Shader) { shader.effect = Shader.effect; }
public void GetShader(ref RShader Shader) { Shader = shader; }
public RMaterial Clone() { int num = 1; for(int i=0; i<RMaterialFactory.Instance._MaterialList.Count; i++) if (RMaterialFactory.Instance._MaterialList.ContainsKey(this.name+num)) { num++; } RMaterial mat = new RMaterial(); RShader sh = new RShader(); sh.effect = shader.effect.Clone(); mat.name = this.name+num; mat.shader = sh; mat.ambColor = ambColor; mat.diffColor = diffColor; mat.ID = RMaterialFactory._instance._MaterialList.Count + 1; mat.specColor = specColor; mat.specPower = specPower; RMaterialFactory._instance._MaterialList.Add(mat.name, mat); return mat; }
public void Load(string filename) { _model = REngine.Instance._content.Load<Model>(filename); Matrix = Matrix.CreateScale(1.0f); Scaling = new Vector3(1f, 1f, 1f); Matrix = BuildScalingMatrix(Matrix); #if XBOX _defaultEffect = REngine.Instance._resourceContent.Load<RShader>("Actor.Xbox"); #elif MACOSX _defaultEffect = RShader.LoadEffectResource("Actor.ogl.mgfxo"); #else _defaultEffect = RShader.LoadEffectResource("Actor.ogl.mgfxo"); #endif _defaultEffect.effect.CurrentTechnique = _defaultEffect.effect.Techniques[0]; _sphere = _model.Meshes[0].BoundingSphere; foreach (ModelMesh mesh in _model.Meshes) { _sphere = BoundingSphere.CreateMerged(_sphere, mesh.BoundingSphere); for (int i = 0; i < mesh.MeshParts.Count; i++) { BasicEffect effect = (BasicEffect)mesh.MeshParts[i].Effect; Texture t = effect.Texture; mesh.MeshParts[i].Effect = _defaultEffect.effect.Clone(); mesh.MeshParts[i].Effect.Parameters["Texture"].SetValue(t); } } _skinningData = _model.Tag as SkinningData; _player = new AnimationPlayer(_skinningData); _player.StartClip(_skinningData.AnimationIndexes[0], 1.0f); _playing = true; }