void DrawTrenchMRT(Trench t) { Matrix world; foreach (var mesh in t.SelectedModel.Meshes) { world = mesh.ParentBone.Transform * t.SRT; MRTcolor.SetValue(new Vector3(0.5f, 0.5f, 0.5f)); MRTworld.SetValue(world); MRTworldViewProjection.SetValue(world * Game.SelectedCamera.View * Game.SelectedCamera.Projection); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); mesh.Draw(); } foreach (var turret in t.Turrets) { foreach (var mesh in TrenchTurret.Meshes) { world = mesh.ParentBone.Transform * turret.SRT; MRTcolor.SetValue(new Vector3(0.5f, 0.5f, 0.5f)); MRTworld.SetValue(world); MRTworldViewProjection.SetValue(world * Game.SelectedCamera.View * Game.SelectedCamera.Projection); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); mesh.Draw(); } } }
void DrawModelMRT(Model model, Matrix SRT, Vector3 color) { foreach (var mesh in model.Meshes) { var world = mesh.ParentBone.Transform * SRT; var wvp = world * Game.SelectedCamera.View * Game.SelectedCamera.Projection; MRTworld.SetValue(world); MRTcolor.SetValue(color); MRTworldViewProjection.SetValue(wvp); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); mesh.Draw(); } }
void DrawTieMRT(TieFighter tie) { Matrix world; MRTmodelNormal.SetValue(TieNormalTex); foreach (var mesh in TieModel.Meshes) { world = mesh.ParentBone.Transform * tie.SRT; var wvp = world * Game.SelectedCamera.View * Game.SelectedCamera.Projection; MRTworld.SetValue(world); MRTtexture.SetValue(TieTexture); MRTworldViewProjection.SetValue(wvp); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); mesh.Draw(); } }
void DrawTieMRT(Ship tie) { Matrix world; //MasterMRT.Parameters["ApplyShieldEffect"]?.SetValue(1f); //MasterMRT.Parameters["ShieldColor"]?.SetValue(new Vector3(0.8f, 0f, 0f)); MRTmodelNormal.SetValue(TieNormalTex); foreach (var mesh in TieModel.Meshes) { world = mesh.ParentBone.Transform * tie.SRT; var wvp = world * Game.SelectedCamera.View * Game.SelectedCamera.Projection; MRTworld.SetValue(world); MRTtexture.SetValue(TieTexture); MRTworldViewProjection.SetValue(wvp); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); mesh.Draw(); } //MasterMRT.Parameters["ApplyShieldEffect"]?.SetValue(0f); }
void DrawXWingMRT(Xwing xwing, DrawType dt) { int meshCount = 0; if (dt == DrawType.Regular) { MasterMRT.CurrentTechnique = MRTbasicColor; } //MRTapplyLightEffect.SetValue(0f); MRTaddToBloomFilter.SetValue(1f); DrawModelMRT(XwingEnginesModel, xwing.EnginesSRT, xwing.EnginesColor); MRTaddToBloomFilter.SetValue(0f); //MRTapplyLightEffect.SetValue(1f); if (dt == DrawType.Regular) { MasterMRT.CurrentTechnique = MRTtextured; } foreach (var mesh in XwingModel.Meshes) { xwing.World = mesh.ParentBone.Transform * xwing.SRT; var wvp = xwing.World * Game.SelectedCamera.View * Game.SelectedCamera.Projection; MRTtexture.SetValue(XwingTextures[meshCount]); MRTmodelNormal.SetValue(XwingNormalTex[meshCount]); MRTworld.SetValue(xwing.World); MRTworldViewProjection.SetValue(wvp); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(xwing.World))); meshCount++; mesh.Draw(); } }
void DrawXwingMRT(Ship xwing) { Matrix world; int meshCount = 0; foreach (var mesh in XwingModel.Meshes) { world = mesh.ParentBone.Transform * xwing.SRT; var wvp = world * Game.SelectedCamera.View * Game.SelectedCamera.Projection; //var itw = Matrix.Transpose(Matrix.Invert(xwing.World)); MRTtexture.SetValue(XwingTextures[meshCount]); MRTmodelNormal.SetValue(XwingNormalTex[meshCount]); MRTworld.SetValue(world); MRTworldViewProjection.SetValue(wvp); //EPMRTlightViewProjection.SetValue(world * Game.LightCamera.View * Game.LightCamera.Projection); MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(world))); meshCount++; mesh.Draw(); } }