Skip to content

Commit 718cf2e

Browse files
committed
cleanup
1 parent 2d5548e commit 718cf2e

1 file changed

Lines changed: 1 addition & 118 deletions

File tree

examples/SharpGLTF.Runtime.MonoGame/MonoGameDrawingContext.cs

Lines changed: 1 addition & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -99,124 +99,7 @@ public void SetCamera(Matrix cameraMatrix)
9999
_View = Matrix.Invert(cameraMatrix);
100100
_Projection = SceneUtils.CreatePerspectiveFieldOfView(_FieldOfView, _Device.Viewport.AspectRatio, _NearPlane);
101101
// _DistanceComparer = MODELINST.GetDistanceComparer(-_View.Translation);
102-
}
103-
104-
105-
/*
106-
public void DrawMesh(PBREnvironment environment, Mesh mesh, Matrix worldMatrix)
107-
{
108-
var proj = GetProjectionMatrix();
109-
110-
PushState();
111-
112-
foreach (var e in mesh.OpaqueEffects)
113-
{
114-
ModelInstance.UpdateProjViewTransforms(e, proj, _View);
115-
ModelInstance.UpdateWorldTransforms(e, worldMatrix);
116-
environment.ApplyTo(e);
117-
}
118-
119-
mesh.DrawOpaque();
120-
121-
foreach (var e in mesh.TranslucidEffects)
122-
{
123-
ModelInstance.UpdateProjViewTransforms(e, proj, _View);
124-
ModelInstance.UpdateWorldTransforms(e, worldMatrix);
125-
environment.ApplyTo(e);
126-
}
127-
128-
mesh.DrawTranslucid();
129-
130-
PopState();
131-
}
132-
133-
/// <summary>
134-
/// Draw a single model instance
135-
/// </summary>
136-
/// <param name="environment">Defines the athmospheric and lighting environment to use for the render.</param>
137-
/// <param name="modelInstance">Defines the instance that is going to be rendered.</param>
138-
/// <remarks>
139-
/// Rendering models one by one is accepted, but some features like translucent parts sortings will not work
140-
/// unless you manually render the models in the correct order.
141-
/// </remarks>
142-
public void DrawModelInstance(PBREnvironment environment, MODELINST modelInstance)
143-
{
144-
PushState();
145-
146-
var proj = GetProjectionMatrix();
147-
148-
foreach (var e in modelInstance.SharedEffects)
149-
{
150-
environment.ApplyTo(e);
151-
ModelInstance.UpdateProjViewTransforms(e, proj, _View);
152-
}
153-
154-
modelInstance.DrawAllParts(proj, _View);
155-
156-
PopState();
157-
}
158-
159-
/// <summary>
160-
/// Draws a batch of model instances.
161-
/// </summary>
162-
/// <param name="environment">Defines the athmospheric and lighting environment to use for the render.</param>
163-
/// <param name="modelInstances">A batch of model instances.</param>
164-
/// <remarks>
165-
/// Rendering multiple models in a batch has a number of advantages over rendering models one by one:
166-
/// - It allows splitting the rendering between opaque and translucent parts, which are rendered in the correct
167-
/// order to preserve rendering correctness.
168-
/// - Less redundant calls.
169-
/// - Futher optimizations are possible, like batching instances that share the same template model in a single
170-
/// drawing call.
171-
/// - Possibility to add shadows, where some instances cast shadows over others.
172-
/// </remarks>
173-
public void DrawSceneInstances(PBREnvironment environment, params MODELINST[] modelInstances)
174-
{
175-
PushState();
176-
177-
// todo: fustrum culling goes here
178-
179-
var proj = GetProjectionMatrix();
180-
181-
_SceneInstances.Clear();
182-
_SceneInstances.AddRange(modelInstances);
183-
_SceneInstances.Sort(_DistanceComparer);
184-
185-
// gather all effects from all visible instances.
186-
_SceneEffects.Clear();
187-
_SceneEffects.UnionWith(_SceneInstances.SelectMany(item => item.SharedEffects));
188-
189-
// set Projection & View on all visible effects.
190-
191-
foreach (var e in _SceneEffects)
192-
{
193-
ModelInstance.UpdateProjViewTransforms(e, proj, _View);
194-
// todo: set env.Exposure
195-
// todo: set env.AmbientLight
196-
}
197-
198-
// todo: find the closest lights for each visible instance.
199-
200-
// render opaque parts from closest to farthest
201-
202-
foreach (var instance in _SceneInstances)
203-
{
204-
foreach (var e in instance.SharedEffects) environment.ApplyTo(e);
205-
instance.DrawOpaqueParts();
206-
}
207-
208-
// render translucid parts from farthest to closest
209-
210-
_SceneInstances.Reverse();
211-
212-
foreach (var instance in _SceneInstances)
213-
{
214-
foreach (var e in instance.SharedEffects) environment.ApplyTo(e);
215-
instance.DrawTranslucidParts();
216-
}
217-
218-
PopState();
219-
}*/
102+
}
220103

221104
#endregion
222105
}

0 commit comments

Comments
 (0)