-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some Swift types for basic Swift engine SDK. Still WIP
- Loading branch information
1 parent
41e755b
commit dc9859f
Showing
25 changed files
with
269 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class Object { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@propertyWrapper | ||
struct Reference<T> { | ||
var uuid: String? | ||
|
||
init(uuid: String? = nil) { | ||
self.uuid = uuid | ||
} | ||
|
||
var wrappedValue: T? { | ||
get { | ||
guard let uuid = uuid else { | ||
return nil | ||
} | ||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
|
||
class Asset { | ||
var name: String | ||
var path: String | ||
var type: String | ||
var data: Data? | ||
var uuid: String | ||
|
||
init(name: String, path: String, type: String, data: Data, uuid: String) { | ||
self.name = name | ||
self.path = path | ||
self.type = type | ||
self.uuid = uuid | ||
self.data = data | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AssetManager { | ||
static let shared = AssetManager() | ||
|
||
private init() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
public class AssetPackage { | ||
public init(path: String) { | ||
|
||
} | ||
|
||
public func hasAsset<T>(type: T.Type, uuid: String) -> Bool { | ||
return false | ||
} | ||
|
||
public func getAsset<T>(type: T.Type, uuid: String) -> T? { | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class AssetPackageManager { | ||
static let shared = AssetPackageManager() | ||
|
||
private init() { | ||
} | ||
|
||
lazy var packages: [AssetPackage] = { | ||
return [] | ||
}() | ||
} |
4 changes: 4 additions & 0 deletions
4
scripting/engine/ecs/builtin/components/MaterialComponent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@Component public struct MaterialComponent: Codable { | ||
@Reference(type: Material.self) | ||
public var material: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@Component public struct MeshComponent { | ||
public var mesh: Mesh | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Foundation | ||
|
||
public class Material { | ||
internal var uuid: String | ||
public var name: String | ||
public var shader: Shader? | ||
public var properties: [String: Any] = [:] | ||
|
||
init(name: String, uuid: String) { | ||
self.name = name | ||
self.uuid = uuid | ||
|
||
AssetManager.shared | ||
} | ||
|
||
public init() { | ||
self.name = "" | ||
self.uuid = UUID().uuidString | ||
} | ||
|
||
public func load() { | ||
|
||
} | ||
|
||
public func setFloat(name: String, value: Float) { | ||
properties[name] = value | ||
} | ||
|
||
public func setVector2(name: String, value: Vector2) { | ||
properties[name] = value | ||
} | ||
|
||
public func setVector3(name: String, value: Vector3) { | ||
properties[name] = value | ||
} | ||
|
||
public func setVector4(name: String, value: Vector4) { | ||
properties[name] = value | ||
} | ||
|
||
public func setTexture(name: String, value: Texture) { | ||
properties[name] = value | ||
} | ||
|
||
public func setInt(name: String, value: Int) { | ||
properties[name] = value | ||
} | ||
|
||
public func setBool(name: String, value: Bool) { | ||
properties[name] = value | ||
} | ||
} |
Oops, something went wrong.