Skip to content

Commit ff74cd9

Browse files
committed
Enable more public entities
1 parent 4a16a24 commit ff74cd9

6 files changed

Lines changed: 36 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## Unreleased
8+
9+
## 1.0.2
10+
11+
### Changed
12+
* Enable public entities unintentionally left private
13+
*
14+
715
## 1.0.1
816

917
### Changed

Sources/StructureKit/Metal/STKARKitOverlayRenderer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ import MetalKit
3131
import StructureKitCTypes
3232

3333
// Draws an ARKit face geometry as a white transparent mesh
34-
class STKARKitOverlayRenderer {
34+
public class STKARKitOverlayRenderer {
3535
var arkitToWorld = simd_float4x4()
3636
private var depthStencilARKitState: MTLDepthStencilState
3737
private var renderARKitState: MTLRenderPipelineState
3838

39-
init(view: MTKView, device: MTLDevice) {
39+
public init(view: MTKView, device: MTLDevice) {
4040
let depthStencilDescriptor = MTLDepthStencilDescriptor()
4141
depthStencilDescriptor.depthCompareFunction = .less
4242
depthStencilDescriptor.isDepthWriteEnabled = true
@@ -65,7 +65,7 @@ class STKARKitOverlayRenderer {
6565
renderARKitState = try! device.makeRenderPipelineState(descriptor: pipelineMeshDescriptor)
6666
}
6767

68-
func renderARkitGeom(
68+
public func renderARkitGeom(
6969
_ commandEncoder: MTLRenderCommandEncoder,
7070
mesh: STKDrawableObject,
7171
cameraPosition: float4x4,

Sources/StructureKit/Metal/STKCommon.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,23 @@ import StructureKitCTypes
3535
extension String: Error {}
3636

3737
public class STKShaderManager {
38-
static let pixelFormat = MTLPixelFormat.bgra8Unorm
39-
static let depthFormat = MTLPixelFormat.depth32Float
40-
static let device = MTLCreateSystemDefaultDevice()!
41-
42-
static let solid = STKMeshRendererSolid(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
43-
static let wireframe = STKMeshRendererWireframe(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
44-
static let vertexColor = STKMeshRendererColor(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
45-
static let textureShader = STKMeshRendererTexture(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
46-
static let pointCloud = STKMeshRendererPoints(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
47-
static let lines = STKMeshRendererLines(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
38+
public static let pixelFormat = MTLPixelFormat.bgra8Unorm
39+
public static let depthFormat = MTLPixelFormat.depth32Float
40+
public static let device = MTLCreateSystemDefaultDevice()!
41+
42+
public static let solid = STKMeshRendererSolid(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
43+
public static let wireframe = STKMeshRendererWireframe(
44+
colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
45+
public static let vertexColor = STKMeshRendererColor(
46+
colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
47+
public static let textureShader = STKMeshRendererTexture(
48+
colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
49+
public static let pointCloud = STKMeshRendererPoints(
50+
colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
51+
public static let lines = STKMeshRendererLines(colorFormat: pixelFormat, depthFormat: depthFormat, device: device)
4852
}
4953

5054
extension float4x4 {
51-
public init() { self = float4x4.identity() }
52-
5355
public init(_ m: GLKMatrix4) { self = unsafeBitCast(m, to: float4x4.self) }
5456

5557
public func toGLK() -> GLKMatrix4 { SCNMatrix4ToGLKMatrix4(SCNMatrix4(self)) }

Sources/StructureKit/Metal/STKDepthRenderer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import StructureKitCTypes
3434
// 1. the depth frame
3535
// 2. the cube
3636
// 3. the depth overlay inside the cube
37-
class STKDepthRenderer {
37+
public class STKDepthRenderer {
3838
private var mtkView: MTKView
3939
private var renderDepthState: MTLRenderPipelineState
4040
private var renderDepthFrameState: MTLRenderPipelineState
@@ -53,7 +53,7 @@ class STKDepthRenderer {
5353
private var _vertexCubeBuffer: MTLBuffer!
5454
private var _indexCubeBuffer: MTLBuffer!
5555

56-
init(view: MTKView, device: MTLDevice) {
56+
public init(view: MTKView, device: MTLDevice) {
5757
mtkView = view
5858
self.device = device
5959

@@ -154,7 +154,7 @@ class STKDepthRenderer {
154154
textureColor?.replace(region: region, mipmapLevel: 0, withBytes: &depthRenderingColors, bytesPerRow: bytesPerRow)
155155
}
156156

157-
func uploadColorTextureFromDepth(_ depthFrame: STKDepthFrame) {
157+
public func uploadColorTextureFromDepth(_ depthFrame: STKDepthFrame) {
158158
if let texture = textureDepth {
159159
if texture.width != depthFrame.width || texture.height != depthFrame.height {
160160
textureDepth = nil // invalidate texture
@@ -178,7 +178,7 @@ class STKDepthRenderer {
178178
textureDepth?.replace(region: region, mipmapLevel: 0, withBytes: depthMap!, bytesPerRow: bytesPerRow)
179179
}
180180

181-
func renderDepthOverlay(
181+
public func renderDepthOverlay(
182182
_ commandEncoder: MTLRenderCommandEncoder,
183183
volumeSizeInMeters: simd_float3,
184184
cameraPosition: float4x4,
@@ -228,7 +228,7 @@ class STKDepthRenderer {
228228
commandEncoder.popDebugGroup()
229229
}
230230

231-
func renderDepthFrame(
231+
public func renderDepthFrame(
232232
_ commandEncoder: MTLRenderCommandEncoder,
233233
orientation: float4x4,
234234
minDepth: Float,
@@ -257,7 +257,7 @@ class STKDepthRenderer {
257257

258258
}
259259

260-
func renderCubeOutline(
260+
public func renderCubeOutline(
261261
_ commandEncoder: MTLRenderCommandEncoder,
262262
volumeSizeInMeters: simd_float3,
263263
cameraPosition: float4x4,

Sources/StructureKit/Metal/STKLineRenderer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import MetalKit
3131
import StructureKitCTypes
3232

3333
// Draws colored lines in the world coordinate system
34-
class STKLineRenderer {
34+
public class STKLineRenderer {
3535
private var renderLineState: MTLRenderPipelineState!
3636
private var vertexCubeBuffer: MTLBuffer!
3737
private var indexCubeBuffer: MTLBuffer!
@@ -52,7 +52,7 @@ class STKLineRenderer {
5252
simd_float4(0, 1, 1, 1),
5353
]
5454

55-
init(view: MTKView, device: MTLDevice) {
55+
public init(view: MTKView, device: MTLDevice) {
5656
mtkView = view
5757
let library = STKMetalLibLoader.load(device: device)
5858
let pipelineCubeDescriptor = MTLRenderPipelineDescriptor()
@@ -106,7 +106,7 @@ class STKLineRenderer {
106106
bytes: triadIndices, length: MemoryLayout<UInt32>.stride * triadIndices.count, options: [])!
107107
}
108108

109-
func renderCubeOutline(
109+
public func renderCubeOutline(
110110
_ commandEncoder: MTLRenderCommandEncoder,
111111
volumeSizeInMeters: simd_float3,
112112
cameraPosition: float4x4,
@@ -141,7 +141,7 @@ class STKLineRenderer {
141141
)
142142
}
143143

144-
func renderAnchors(
144+
public func renderAnchors(
145145
_ commandEncoder: MTLRenderCommandEncoder,
146146
anchors: [simd_float4x4],
147147
cameraPosition: float4x4,

Sources/StructureKit/Metal/STKMeshRenderers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public class STKMeshRendererTexture: STKShader {
367367
}
368368

369369
// Renders a mesh in grayscale, uses the mesh normals to calculate light
370-
class STKMeshRendererPoints: STKShader {
370+
public class STKMeshRendererPoints: STKShader {
371371
private var depthStencilState: MTLDepthStencilState
372372
private var pipelineState: MTLRenderPipelineState
373373

0 commit comments

Comments
 (0)