| 219 | } |
| 220 | |
| 221 | void Mesh::Draw(const RenderContext& renderContext, MaterialBase* material, const Matrix& world, StaticFlags flags, bool receiveDecals, DrawPass drawModes, float perInstanceRandom, int8 sortOrder, uint8 stencilValue) const |
| 222 | { |
| 223 | if (!material || !material->IsSurface() || !IsInitialized()) |
| 224 | return; |
| 225 | drawModes &= material->GetDrawModes(); |
| 226 | if (drawModes == DrawPass::None) |
| 227 | return; |
| 228 | |
| 229 | // Setup draw call |
| 230 | DrawCall drawCall; |
| 231 | drawCall.Geometry.IndexBuffer = _indexBuffer; |
| 232 | drawCall.Geometry.VertexBuffers[0] = _vertexBuffers[0]; |
| 233 | drawCall.Geometry.VertexBuffers[1] = _vertexBuffers[1]; |
| 234 | drawCall.Geometry.VertexBuffers[2] = _vertexBuffers[2]; |
| 235 | drawCall.Draw.IndicesCount = _triangles * 3; |
| 236 | drawCall.InstanceCount = 1; |
| 237 | drawCall.Material = material; |
| 238 | drawCall.World = world; |
| 239 | drawCall.ObjectPosition = drawCall.World.GetTranslation(); |
| 240 | drawCall.ObjectRadius = (float)_sphere.Radius * drawCall.World.GetScaleVector().GetAbsolute().MaxValue(); |
| 241 | drawCall.Surface.GeometrySize = _box.GetSize(); |
| 242 | drawCall.Surface.PrevWorld = world; |
| 243 | drawCall.PerInstanceRandom = perInstanceRandom; |
| 244 | drawCall.StencilValue = stencilValue; |
| 245 | #if USE_EDITOR |
| 246 | const ViewMode viewMode = renderContext.View.Mode; |
| 247 | if (viewMode == ViewMode::LightmapUVsDensity || viewMode == ViewMode::LODPreview) |
| 248 | GBufferPass::AddIndexBufferToModelLOD(_indexBuffer, &((Model*)_model)->LODs[_lodIndex]); |
| 249 | #endif |
| 250 | |
| 251 | // Push draw call to the render list |
| 252 | renderContext.List->AddDrawCall(renderContext, drawModes, flags, drawCall, receiveDecals, sortOrder); |
| 253 | } |
| 254 | |
| 255 | void Mesh::Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const |
| 256 | { |
no test coverage detected