Git Product home page Git Product logo

swiftbgfx's Introduction

SwiftBGFX

Join the chat at https://gitter.im/stuartcarnie/SwiftBGFX

Swift bindings to bgfx, a cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

Status

This framework is currently in alpha and it should be noted that the public API is still subject to change, particularly as I move further away from the C bindings towards idiomatic Swift.

The examples are in a barely working state, to exercise the bindings, however these will be improved. I would

Swift Package Manager

I also plan to use the Swift Package Manager and file bugs if there are any issues. Recently, support landed for compiling C.

Fetching

$ git clone --recursive https://github.com/stuartcarnie/SwiftBGFX.git

Building

OS X

Build bgfx library

$ cd SwiftBGFX/3rdparty/bgfx+
$ make -j 8 osx

build Math package

$ cd SwiftBGFX/3rdparty/Math
$ swift build

Open workspace and build / run example

Examples

  • 00-helloworld
  • 01-cubes
  • 05-instancing

Note:

Before running the examples, edit the scheme and configure the BGFX_RUNTIME_PATH environment variable to the full path of 3rdparty/bgfx/examples/runtime, to ensure the assets can be found. I'll fix this in a future update.

License (BSD 2-clause)

Copyright 2016 Stuart Carnie. All rights reserved.

https://github.com/stuartcarnie/SwiftBGFX

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

swiftbgfx's People

Contributors

gitter-badger avatar s1ddok avatar stuartcarnie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swiftbgfx's Issues

enhancement - decouple examples into separate repo

currently to build mac os project
the readme appears out of date.

there's no +
cd SwiftBGFX/3rdparty/bgfx+

there also appears to be no Math
cd SwiftBGFX/3rdparty/Math

when I run make macos - it all compiles fine.

// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "examples",
    dependencies: [
        .package(url: "https://github.com/SwiftGFX/SwiftBGFX", .upToNextMinor(from: "2.0.0")),
        .package(url: "https://github.com/SwiftGFX/SwiftMath", .upToNextMinor(from: "3.0.0")),
        // Dependencies declare other packages that this package depends on.
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "examples",
            dependencies: ["SwiftMath","SwiftBGFX"]),
    ]
)

UPDATe
I just spent 20 mins faffing around trying to get the samples working - but all I actually wanted was to see the code being used in another project - consider adding Fiber2D on homepage.
https://github.com/s1ddok/Fiber2D

import SwiftBGFX No such module 'SwiftBGFX'

I follow the operation of the document , create libSwiftMath.a and libSwiftBGFX.a , I didn't found SwiftBGFX.swift.o file in libSwiftBGFX.a. This problem puzzled me for two months😢. Help me please~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.