ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - Viktoo/Insert3D: The fastest 🚀 way to embed a 3D model in Swift
The fastest 🚀 way to embed a 3D model in Swift. Contribute to Viktoo/Insert3D development by creating an account on GitHub.
Visit Site

GitHub - Viktoo/Insert3D: The fastest 🚀 way to embed a 3D model in Swift

GitHub - Viktoo/Insert3D: The fastest 🚀 way to embed a 3D model in Swift

Insert3D is the easiest 🥳 and fastest 🚀 way to embed a 3D model in your iOS app. It combines SceneKit and Model I/O into a simple library for creative iOS developers who want to provide a unique experience for their users. This library uniquely supports both:

  • Static implementations to easily replace images with engaging 3D content without learning SceneKit.
  • Dynamic implementations where models need to be programmatically loaded via URLs using the raw 3D filetype on run-time.

Installation

Use CocoaPods. Add the dependency to your Podfile and then run pod install:

pod 'Insert3D'

Quickstart

  1. Import library
import Insert3D
  1. Download and add example OBJ model (example-model.zip)

  2. Copy & Paste into viewDidLoad

var viewer = Insert3DViewer() 
	viewer.width = 380 
	viewer.height = 380

var model = Insert3DModel()
	model.mesh = "model/Nachos.obj"
	model.material = "model/NachosMaterial.jpg"

view.Insert3D(viewerSetup: viewer, modelSetup: model)

Usage

Create instances of Insert3DViewer() and Insert3DModel() and specify parameters, then pass the instances into the main view.Insert3D() function to complete setup and display the viewer.

Command + R to Run

Viewer

Instances of Insert3DViewer() set the dimensions and position of the SCNView subview where the model is a central node.

// Values can be progromatically set and adjusted at any time 
var viewer = Insert3DViewer() 
viewer.width = 380 // Width 
viewer.height = 380 // Height 
viewer.x = 20 // X position of the top left corner
viewer.y = 200 // Y position of the top left corner

viewer.background = UIColor.white // Specify background of viewer. White by default 

// Show the model! 
view.Insert3D(viewerSetup: viewer, modelSetup: model) // modelSetup is also required

Dimensions

Dimensions using the relative position on screen can be expressed by converting them into Int. For example, to center align the viewer, set the value for x equal to Int(UIScreen.main.bounds.size.width*0.5) - viewer.width/2.

Included are default values width = 200, height = 200, x = 0, and y = 0.

Background

Background support's Any, providing much flexibility for usage:

Model

Instances of Insert3DModel() let Insert3D() know which model you'd like to use, along with how you'd like it configured within the viewer.

// Values can be progromatically set and adjusted at any time.
var model = Insert3DModel()
model.mesh = "my3DFilePath" // Currently supports OBJ. 
model.texture = "myTexturePath" // Supports image files already mapped to the model

model.autoRotate = true // Set true by default. Rotates on the horizontal axis
model.rotationSpeed = 9 // Model makes one full rotation every 9 seconds

model.fixed = false // Set false by deafault. Should the model be movable/rotatable by a user?

// Show the model!
view.Insert3D(viewerSetup: viewer, modelSetup: model) // viewerSetup is also required

NOTE: There are infinite possible customization one could apply to a model, and included here are the basic ones. Consider expanding this repository's functionality via a contribution.

Load via URL

The model and texture paths are a String. This means you can load a model + texture dynamically using URL(string: "https://myURL/file")

Contributing

  1. Fork it ( https://github.com/Viktoo/Insert3D/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

This project is released under the BSD 2-Clause "Simplified" License

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory