colors - 更改 SCNText 节点对象的颜色或纹理(Swift - Scenekit)

标签 colors swift textures ios8 scenekit

如何设置 SCNText 对象的纹理?这就是我所拥有的,外观没有任何变化:

// myNode is a working SCNText element 

let mat = SCNMaterial()
met.diffuse.contents = UIImage(contentsOfFile: "texture.png")
myNode.geometry.firstMaterial = mat

最佳答案

A text geometry may contain one, three, or five geometry elements:

If its extrusionDepth property is 0.0, the text geometry has one element corresponding to its one visible side. If its extrusion depth is greater than zero and its chamferRadius property is 0.0, the text geometry has three elements, corresponding to its front, back, and extruded sides. If both extrusion depth and chamfer radius are greater than zero, the text geometry has five elements, corresponding to its front, back, extruded sides, front chamfer, and back chamfer. Scene Kit can render each element using a different material. For details, see the description of the materials property in SCNGeometry Class Reference.

就像任何其他几何体一样,只需设置其 materials 属性即可。

关于colors - 更改 SCNText 节点对象的颜色或纹理(Swift - Scenekit),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25268386/

相关文章:

java - JOGL 的纹理加载

c++ - 为 OpenGL 纹理加载带有 stb_image 的 PNG 会给出错误的颜色

java - 尝试划分颜色来绘制彩虹 donut

ios - 适用于iOS的自定义颜色选择器

c - OpenGL 纹理显示为实体对象?

xcode - iOS (Swift) - View Controller 上的选项卡式导航

ios - 如何处理 TextField 的 shouldChangeCharactersIn(如果它位于 TabelViewControler 的自定义单元格中)

c++ - OpenGL 纹理未按定义出现

python - 如何在按键时更改pygame中文本的颜色?

ios - 如何将 Linphone 集成到 IOS Swift - 开发 iOS 7/8