|
203 | 203 |
|
204 | 204 | /** Adds lines to the scene for rendering. |
205 | 205 | - parameter lines: The lines to draw. |
206 | | - - parameter material: The color information used to draw the geometry. |
207 | 206 | - parameter transform: Describes how the lines instance should be positioned and scaled relative to the scene. |
208 | 207 | - parameter flags: Options to customize how drawing is handled. |
209 | 208 | - Explicitly instances the geometry as it's own batch. Use this for known instancing like particles. |
210 | 209 | */ |
211 | 210 | @_transparent |
212 | 211 | public mutating func insert( |
213 | 212 | _ lines: Lines, |
214 | | - withMaterial material: Material, |
215 | 213 | at transform: Transform3, |
216 | 214 | flags: SceneElementFlags = .default |
217 | 215 | ) { |
218 | | - self.insert(lines, withMaterial: material, at: [transform], flags: flags) |
| 216 | + self.insert(lines, at: [transform], flags: flags) |
219 | 217 | } |
220 | 218 |
|
221 | 219 | /** Adds lines to the scene for rendering. |
222 | 220 | - parameter lines: The lines to draw. |
223 | | - - parameter material: The color information used to draw the geometry. |
224 | 221 | - parameter transforms: Describes how each lines instance should be positioned and scaled relative to the scene. |
225 | 222 | - parameter flags: Options to customize how drawing is handled. |
226 | 223 | - Explicitly instances the geometry as it's own batch. Use this for known instancing like particles. |
227 | 224 | */ |
228 | 225 | @inlinable @inline(__always) |
229 | 226 | public mutating func insert( |
230 | 227 | _ lines: Lines, |
231 | | - withMaterial material: Material, |
232 | 228 | at transforms: [Transform3], |
233 | 229 | flags: SceneElementFlags = .default |
234 | 230 | ) { |
235 | 231 | let command = DrawCommand( |
236 | 232 | resource: .lines(lines), |
237 | 233 | transforms: transforms, |
238 | | - material: material, |
239 | | - vsh: .standard, |
| 234 | + material: Material(color: .vertexColors), |
| 235 | + vsh: .vertexColors, |
240 | 236 | fsh: .vertexColor, |
241 | 237 | flags: flags.drawCommandFlags(withPrimitive: .line) |
242 | 238 | ) |
243 | 239 | self.insert(command) |
244 | 240 | } |
| 241 | + |
| 242 | + /** Adds lines to the scene for rendering. |
| 243 | + - parameter lines: The lines to draw. |
| 244 | + - parameter color: The color information used to draw the geometry. |
| 245 | + - parameter transform: Describes how the lines instance should be positioned and scaled relative to the scene. |
| 246 | + - parameter flags: Options to customize how drawing is handled. |
| 247 | + - Explicitly instances the geometry as it's own batch. Use this for known instancing like particles. |
| 248 | + */ |
| 249 | + @_transparent |
| 250 | + public mutating func insert( |
| 251 | + _ lines: Lines, |
| 252 | + withColor color: Color, |
| 253 | + at transform: Transform3, |
| 254 | + flags: SceneElementFlags = .default |
| 255 | + ) { |
| 256 | + self.insert(lines, withColor: color, at: [transform], flags: flags) |
| 257 | + } |
| 258 | + |
| 259 | + /** Adds lines to the scene for rendering. |
| 260 | + - parameter lines: The lines to draw. |
| 261 | + - parameter color: The color information used to draw the geometry. |
| 262 | + - parameter transforms: Describes how each lines instance should be positioned and scaled relative to the scene. |
| 263 | + - parameter flags: Options to customize how drawing is handled. |
| 264 | + - Explicitly instances the geometry as it's own batch. Use this for known instancing like particles. |
| 265 | + */ |
| 266 | + @inlinable @inline(__always) |
| 267 | + public mutating func insert( |
| 268 | + _ lines: Lines, |
| 269 | + withColor color: Color, |
| 270 | + at transforms: [Transform3], |
| 271 | + flags: SceneElementFlags = .default |
| 272 | + ) { |
| 273 | + let command = DrawCommand( |
| 274 | + resource: .lines(lines), |
| 275 | + transforms: transforms, |
| 276 | + material: Material(color: color), |
| 277 | + vsh: .standard, |
| 278 | + fsh: .materialColor, |
| 279 | + flags: flags.drawCommandFlags(withPrimitive: .line) |
| 280 | + ) |
| 281 | + self.insert(command) |
| 282 | + } |
245 | 283 |
|
246 | 284 | @inlinable @inline(__always) |
247 | 285 | public mutating func insert( |
@@ -458,7 +496,7 @@ public struct SceneElementFlags: OptionSet, Hashable { |
458 | 496 | @_transparent |
459 | 497 | public func drawCommandFlags(withPrimitive primitive: DrawCommand.Flags.Primitive, blendMode: DrawCommand.Flags.BlendMode = .normal) -> DrawCommand.Flags { |
460 | 498 | let cull: DrawCommand.Flags.Cull = self.contains(.cullBackface) ? .back : .disabled |
461 | | - let depthTest: DrawCommand.Flags.DepthTest = self.contains(.disableDepthCull) ? .always : .less |
| 499 | + let depthTest: DrawCommand.Flags.DepthTest = self.contains(.disableDepthCull) ? .always : .lessEqual |
462 | 500 | let depthWrite: DrawCommand.Flags.DepthWrite = |
463 | 501 | self.contains(.disableDepthWrite) ? .disabled : .enabled |
464 | 502 | return DrawCommand.Flags( |
|
0 commit comments