Advertisement
Guest User

Untitled

a guest
May 13th, 2022
23
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public void Draw(Matrix world, Matrix view, Matrix projection, float farClip, Texture2D depthTexture)
  2.         {
  3.             if (!Enabled || brushLocation == null)
  4.                 return;
  5.  
  6.             foreach (ModelMesh mesh in Assets.decalCube.Meshes)
  7.             {
  8.                 foreach (ModelMeshPart meshPart in mesh.MeshParts)
  9.                 {
  10.                     meshPart.Effect = Assets.decalEffect;
  11.  
  12.                     Assets.decalEffect.CurrentTechnique = Assets.decalEffect.Techniques["BasicColorDrawing"];
  13.  
  14.                     Assets.decalEffect.Parameters["DecalTexture"].SetValue(Assets.snow);
  15.                     Assets.decalEffect.Parameters["Depth"].SetValue(depthTexture);
  16.                     Assets.decalEffect.Parameters["World"].SetValue(world * Matrix.CreateScale(1) * brushRotation * Matrix.CreateTranslation((Vector3)brushLocation));
  17.                     Assets.decalEffect.Parameters["View"].SetValue(view);
  18.                     Assets.decalEffect.Parameters["Projection"].SetValue(projection);
  19.                     Assets.decalEffect.Parameters["InverseWorldView"].SetValue(Matrix.Invert(view) * Matrix.Invert(world * Matrix.CreateScale(1) * brushRotation * Matrix.CreateTranslation((Vector3)brushLocation)));
  20.                     Assets.decalEffect.Parameters["FarClip"].SetValue(farClip);
  21.  
  22.                     Assets.decalEffect.CurrentTechnique.Passes[0].Apply();
  23.                 }
  24.                    
  25.                 mesh.Draw();
  26.             }
  27.         }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement