小编Adi*_*rer的帖子

自定义着色器SCNProgram iOS 9 Scenekit

我试图搞砸SceneKit并自学它.基本上,我正在创建一个带有3个矩形边和1个倾斜滑块的四边形.

我希望我的纹理在表面上伸展和变形/变形.

在线阅读一些内容,似乎我需要SCNProgram使用自定义顶点和片段着色器来获得效果.但是,我似乎无法让纹理在表面上传播.需要帮助.(我是图形编程的新手,因此试图教给我自己).

我的Swift代码创建几何和纹理如下:

func geometryCreate() -> SCNNode {  

    let verticesPosition = [  
        SCNVector3Make(0.0, 0.0, 0.0),  
        SCNVector3Make(5.0, 0.0, 0.0),  
        SCNVector3Make(5.0, 5.0, 0.0),  
        SCNVector3Make(0.0, 3.0, 0.0)  
    ]  
    let textureCord =    [CGPoint (x: 0.0,y: 0.0), CGPoint(x: 1.0,y: 0.0), CGPoint(x: 1.0,y: 1.0), CGPoint(x: 0.0,y: 1.0)]  

    let indices: [CInt] = [  
    0, 2, 3,  
    0, 1, 2  
    ]  

    let vertexSource = SCNGeometrySource(vertices: verticesPosition, count: 4)  
    let srcTex = SCNGeometrySource(textureCoordinates: textureCord, count: 4)  
    let date = NSData(bytes: indices, length: sizeof(CInt) * …
Run Code Online (Sandbox Code Playgroud)

opengl-es fragment-shader ios scenekit ios9

11
推荐指数
1
解决办法
2439
查看次数

标签 统计

fragment-shader ×1

ios ×1

ios9 ×1

opengl-es ×1

scenekit ×1