add texture to 3D Cylinder
This commit is contained in:
parent
f5b147259a
commit
6c61b97d2c
23
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/Contents.json
vendored
Normal file
23
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "logo_kante.jpg",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "logo_kante-1.jpg",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "logo_kante-2.jpg",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-1.jpg
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-1.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-2.jpg
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante-2.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante.jpg
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_kante.imageset/logo_kante.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
23
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/Contents.json
vendored
Normal file
23
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "logo_no_background.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "logo_no_background-1.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "logo_no_background-2.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-1.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-1.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-2.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background-2.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background.png
vendored
Normal file
BIN
GoldWars/GoldWars/Assets.xcassets/logo_no_background.imageset/logo_no_background.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
@ -39,9 +39,21 @@ class MenuScene: SKScene {
|
|||||||
|
|
||||||
let scnScene: SCNScene = {
|
let scnScene: SCNScene = {
|
||||||
let scnScene = SCNScene()
|
let scnScene = SCNScene()
|
||||||
let cylinder = SCNCylinder(radius: 120, height: 30)
|
let cylinder = SCNCylinder(radius: 250, height: 50)
|
||||||
|
|
||||||
|
let material = SCNMaterial()
|
||||||
|
let material2 = SCNMaterial()
|
||||||
|
material.diffuse.contents = UIImage(named: "logo_no_background")
|
||||||
|
material2.diffuse.contents = UIImage(named: "logo_kante")
|
||||||
|
|
||||||
|
cylinder.materials = [material2,material,material]
|
||||||
|
|
||||||
|
|
||||||
let cylinderNode = SCNNode(geometry: cylinder)
|
let cylinderNode = SCNNode(geometry: cylinder)
|
||||||
cylinderNode.eulerAngles = SCNVector3(x: Float(CGFloat.pi / 2), y: 0, z: Float(CGFloat.pi / 2))
|
cylinderNode.eulerAngles = SCNVector3(x: Float(CGFloat.pi / 2), y: 0, z: Float(CGFloat.pi / 2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let action = SCNAction.rotateBy(x: CGFloat(GLKMathDegreesToRadians(360)), y:0 , z: 0, duration: 8)
|
let action = SCNAction.rotateBy(x: CGFloat(GLKMathDegreesToRadians(360)), y:0 , z: 0, duration: 8)
|
||||||
let forever = SCNAction.repeatForever(action)
|
let forever = SCNAction.repeatForever(action)
|
||||||
cylinderNode.runAction(forever)
|
cylinderNode.runAction(forever)
|
||||||
@ -49,7 +61,7 @@ class MenuScene: SKScene {
|
|||||||
return scnScene
|
return scnScene
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let node = SK3DNode(viewportSize: CGSize(width: 300, height: 300))
|
let node = SK3DNode(viewportSize: CGSize(width: 250, height: 250))
|
||||||
node.scnScene = scnScene
|
node.scnScene = scnScene
|
||||||
node.position = CGPoint(x: midX, y: midY + 200)
|
node.position = CGPoint(x: midX, y: midY + 200)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user