Skip to content

Commit

Permalink
Add OIIO & OCIO, fix bundle name for assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
furby-tm committed Feb 16, 2024
1 parent 7eb85d0 commit 2988295
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Kraken.usda
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#usda 1.0
(
doc = "Kraken v1.0.4"
doc = "Kraken v1.0.5"
)

def Xform "Hello"
Expand Down
26 changes: 13 additions & 13 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/MetaverseKit.git",
"state" : {
"revision" : "85c0b5bc0dae2f94f8dffa99223745fa7fc239ff",
"version" : "1.4.3"
"revision" : "92c46bd61003a57c85fb727e6d308ad39ced46e4",
"version" : "1.5.1"
}
},
{
Expand Down Expand Up @@ -122,8 +122,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "76d7791b5bda47df7e3d4690c4c3aaf089730707",
"version" : "1.2.1"
"revision" : "551150d5e60e3be78972607d89cd69069cca3e7c",
"version" : "1.2.4"
}
},
{
Expand Down Expand Up @@ -156,10 +156,10 @@
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
}
},
{
Expand Down Expand Up @@ -194,8 +194,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "43c802fb7f96e090dde015344a94b5e85779eff1",
"version" : "509.1.0"
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
}
},
{
Expand All @@ -212,8 +212,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/SwiftUSD.git",
"state" : {
"revision" : "7b6128757848e06b095c2b918986704aff1d6fa4",
"version" : "23.11.21"
"revision" : "4c09027de3b48ef17c458c4ae8ed46e96ca5d2e9",
"version" : "23.11.24"
}
},
{
Expand Down Expand Up @@ -257,8 +257,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
"revision" : "b58e6627149808b40634c4552fcf2f44d0b3ca87",
"version" : "1.1.0"
}
},
{
Expand Down
10 changes: 2 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let package = Package(

// --- 🦄 Package Dependencies. ---
dependencies: [
.package(url: "https://github.com/wabiverse/SwiftUSD.git", from: "23.11.21"),
.package(url: "https://github.com/wabiverse/SwiftUSD.git", from: "23.11.24"),
.package(url: "https://github.com/apple/swift-llbuild.git", revision: "bc3ffd5"),
.package(url: "https://github.com/furby-tm/swift-bundler", from: "2.0.9"),
] + Arch.OS.pkgDeps(),
Expand All @@ -40,13 +40,8 @@ let package = Package(
.target(
name: "KrakenUI",
dependencies: [
.product(name: "PixarUSD", package: "SwiftUSD"),
.target(name: "KrakenKit"),
] + Arch.OS.backend(),
swiftSettings: [
// needed for SwiftUSD.
.interoperabilityMode(.Cxx)
]
] + Arch.OS.backend()
),

.executableTarget(
Expand All @@ -60,7 +55,6 @@ let package = Package(
.process("Resources")
],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug)),
// needed for SwiftUSD.
.interoperabilityMode(.Cxx)
]
Expand Down
80 changes: 60 additions & 20 deletions Sources/Kraken/Creator.swift
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@
/* --------------------------------------------------------------
* :: : K R A K E N : ::
* --------------------------------------------------------------
* @wabistudios :: multiverse :: kraken
/* ----------------------------------------------------------------
* :: : M E T A V E R S E : ::
* ----------------------------------------------------------------
* This software is Licensed under the terms of the Apache License,
* version 2.0 (the "Apache License") with the following additional
* modification; you may not use this file except within compliance
* of the Apache License and the following modification made to it.
* Section 6. Trademarks. is deleted and replaced with:
*
* This program is free software; you can redistribute it, and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* Trademarks. This License does not grant permission to use any of
* its trade names, trademarks, service marks, or the product names
* of this Licensor or its affiliates, except as required to comply
* with Section 4(c.) of this License, and to reproduce the content
* of the NOTICE file.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Check out
* the GNU General Public License for more details.
* This software is distributed in the hope that it will be useful,
* but WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND without even an
* implied warranty of MERCHANTABILITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the Apache License for more details.
*
* You should have received a copy for this software license, the
* GNU General Public License along with this program; or, if not
* write to the Free Software Foundation, Inc., to the address of
* You should have received a copy for this software license of the
* Apache License along with this program; or, if not, please write
* to the Free Software Foundation Inc., with the following address
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (C) 2023 Wabi Foundation.
* All Rights Reserved.
* --------------------------------------------------------------
* Copyright (C) 2024 Wabi Foundation. All Rights Reserved.
* ----------------------------------------------------------------
* . x x x . o o o . x x x . : : : . o x o . : : : .
* -------------------------------------------------------------- */
* ---------------------------------------------------------------- */

import Foundation
import KrakenKit
import KrakenUI
import OCIOBundle
import OpenColorIO
import OpenImageIO
import PixarUSD
import PyBundle
import Python
import SwiftUI

/* --- xxx --- */

public typealias OCIO = OpenColorIO_v2_3
public typealias OIIO = OpenImageIO_v2_5

/* --- xxx --- */

@main
struct Kraken: App
{
static let version = Pixar.Gf.Vec3i(1, 0, 4)
static let version = Pixar.Gf.Vec3i(1, 0, 5)

init()
{
Expand All @@ -50,6 +62,34 @@ struct Kraken: App

/* -------------------------------------------------------- */

/* test some opencolorio api. */
OCIOBundler.shared.ocioInit(config: .aces)
OCIO.GetCurrentConfig()

/* test some openimageio api. */
let dtp = OIIO.TypeDesc.TypeFloat
let fmt = OIIO.ImageSpec(512, 89, 4, dtp)

var fg = OIIO.ImageBuf(.init(std.string("fg.exr")), fmt, OIIO.InitializePixels.Yes)
let bg = OIIO.ImageBuf(.init(std.string("bg.exr")), fmt, OIIO.InitializePixels.Yes)

fg.set_origin(512, 89, 0)

let comp = OIIO.ImageBufAlgo.over(fg, bg, fmt.roi(), 0)
if !comp.has_error()
{
if comp.write(.init(std.string("composite.exr")), OIIO.TypeDesc(.init("UNKNOWN")), .init(""), nil, nil) == false || comp.has_error()
{
Msg.logger.log(level: .info, "Error writing image: \(comp.geterror(true))")
}
}
else
{
Msg.logger.log(level: .info, "Error writing image: \(comp.geterror(true))")
}

/* -------------------------------------------------------- */

/* test some usd symbols, ensure @_spi errors are gone. */
let stage = Pixar.Usd.Stage.createNew("ExampleScene.usda")

Expand Down
2 changes: 1 addition & 1 deletion Sources/KrakenKit/Bundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ public extension Bundle
{
/**
* Where application bundle resources are located. */
static let kraken = Bundle(path: "Metaverse_Kraken.bundle")
static let kraken = Bundle(path: "WabiFoundation_Kraken.bundle")
}

0 comments on commit 2988295

Please sign in to comment.