-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
276 additions
and
169 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"hash":"63a807e2624cec7a705c46b74fcbe64b","readOnly":0,"name":"New project","s":0,"data":{"className":"Project","version":2,"width":8000,"height":8000,"ss":[],"sscounter":0,"s":0,"currentFloor":0,"autoinc":14,"ground":{"texture":"bg_1_fill.png","color":"#fff"},"v":1,"readOnly":0,"items":[{"className":"Floor","name":"First floor","h":275,"puid":"p1","items":[{"className":"Room","x":3750,"y":3750,"z":0,"sX":204,"sY":204,"rtype":0,"h":270,"materials":{"floor":{"texture":"laminate_1_2","color":"#FFFFFF","scale":1,"rotate":0},"ceil":{"texture":"linen_1_4","color":"#FFFFFF","scale":1,"rotate":0},"indoor":{"texture":"wallp_0","color":"#FFFFFF","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#FFFFFF","scale":1,"rotate":0}},"rhidden":false,"fhidden":false,"puid":"p2","items":[{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p3","items":[{"className":"Point","x":0,"y":0,"puid":"p4"},{"className":"Point","x":510,"y":0,"puid":"p5"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p6","items":[{"className":"Point","x":510,"y":0,"puid":"p7"},{"className":"Point","x":510,"y":510,"puid":"p8"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p9","items":[{"className":"Point","x":510,"y":510,"puid":"p10"},{"className":"Point","x":0,"y":510,"puid":"p11"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p12","items":[{"className":"Point","x":0,"y":510,"puid":"p13"},{"className":"Point","x":0,"y":0,"puid":"p14"}]}]}]}]}} | ||
{"hash":"63a807e2624cec7a705c46b74fcbe64b","readOnly":0,"name":"New project","s":0,"data":{"className":"Project","version":2,"width":8000,"height":8000,"ss":[],"sscounter":0,"s":0,"currentFloor":0,"autoinc":14,"ground":{"texture":"path_6.jpg","color":"#767e4c"},"v":1,"readOnly":0,"items":[{"className":"Floor","name":"First floor","h":275,"puid":"p1","items":[{"className":"Room","x":3750,"y":3750,"z":0,"sX":204,"sY":204,"rtype":0,"h":270,"materials":{"floor":{"texture":"laminate_1_2","color":"#FFFFFF","scale":1,"rotate":0},"ceil":{"texture":"linen_1_4","color":"#FFFFFF","scale":1,"rotate":0},"indoor":{"texture":"wallp_0","color":"#FFFFFF","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#FFFFFF","scale":1,"rotate":0}},"rhidden":false,"fhidden":false,"puid":"p2","items":[{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p3","items":[{"className":"Point","x":0,"y":0,"puid":"p4"},{"className":"Point","x":510,"y":0,"puid":"p5"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p6","items":[{"className":"Point","x":510,"y":0,"puid":"p7"},{"className":"Point","x":510,"y":510,"puid":"p8"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p9","items":[{"className":"Point","x":510,"y":510,"puid":"p10"},{"className":"Point","x":0,"y":510,"puid":"p11"}]},{"className":"Wall","hidden":false,"w":10,"materials":{"indoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0},"outdoor":{"texture":"wallp_0","color":"#ffffff","scale":1,"rotate":0}},"puid":"p12","items":[{"className":"Point","x":0,"y":510,"puid":"p13"},{"className":"Point","x":0,"y":0,"puid":"p14"}]}]}]}]}} |
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,106 @@ | ||
// | ||
// TheWall.swift | ||
// 5DPlannerTask | ||
// | ||
// Created by Darius Miliauskas on 12/04/2017. | ||
// Copyright © 2017 Darius Miliauskas. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import SceneKit | ||
|
||
// MARK: Scene Basic Nodes | ||
|
||
class CameraNode: SCNNode { | ||
convenience override init() { | ||
self.init() | ||
self.camera = SCNCamera() | ||
} | ||
} | ||
|
||
class LightNode: SCNNode { | ||
internal var theLight = SCNLight() | ||
var color: UIColor? | ||
|
||
convenience init(type: SCNLight.LightType) { | ||
self.init() | ||
theLight.type = type | ||
self.light = theLight | ||
|
||
if theLight.type == .omni { | ||
self.position = SCNVector3(x: 0, y: 10, z: 10) | ||
} | ||
|
||
if let theColor = color, theLight.type == .ambient { | ||
theLight.color = theColor | ||
} | ||
} | ||
} | ||
|
||
// MARK: Scene Object Nodes | ||
|
||
class WallNode: SCNNode { | ||
var width: CGFloat = 0.0 | ||
var height: CGFloat = 0.0 | ||
var length: CGFloat = 0.0 | ||
var material: Material? | ||
|
||
convenience override init() { | ||
self.init() | ||
let geometry = SCNBox(width: width, height: height, length: length, chamferRadius: 0) | ||
self.geometry = geometry | ||
self.position = SCNVector3(x: 0, y: 0, z: 0) | ||
if let imageName = material?.imageName, let color = material?.color { | ||
geometry.firstMaterial?.diffuse.contents = color | ||
geometry.firstMaterial?.diffuse.contents = UIImage(named: imageName) | ||
} | ||
} | ||
|
||
func setup(wall: Wall) { | ||
// self.init() | ||
guard let point1 = wall.points.first, let point2 = wall.points.last else { | ||
return | ||
} | ||
|
||
guard let x1 = point1.pointX, let y1 = point1.pointY else { | ||
return | ||
} | ||
|
||
guard let x2 = point2.pointX, let y2 = point2.pointY else { | ||
return | ||
} | ||
|
||
self.position = SCNVector3(x: Float(x1), y: Float(y1), z: 0) | ||
let height = CGFloat(sqrt(Double(x1*x2 + y1*y2))) | ||
|
||
if let width = wall.w, let length = wall.h { | ||
self.length = length | ||
|
||
if x1 == x2 { | ||
self.width = width | ||
self.height = height | ||
} | ||
|
||
if y1 == y2 { | ||
self.width = height | ||
self.height = width | ||
} | ||
} | ||
} | ||
} | ||
|
||
class SphereNode: SCNNode { | ||
var radius: CGFloat? = 1.0 | ||
var color: UIColor? | ||
var material: Material? | ||
|
||
convenience override init() { | ||
self.init() | ||
if let radius = radius, let imageName = material?.imageName, let color = material?.color { | ||
let sphereGeometry = SCNSphere(radius: radius) | ||
sphereGeometry.firstMaterial?.diffuse.contents = color | ||
sphereGeometry.firstMaterial?.diffuse.contents = UIImage(named: imageName) | ||
} | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.