I am using SCNShadable's shader modifiers in SceneKit. I want to pass an array of float vectors (float3's).
In the SCNShadable docs, under the section "Providing Custom Inputs to a Shader Modifier", the following table is presented with data type conversions:
To pass a value to the shader, one must wrap the value in one of the specified types. It does not seem as array types are supported, but only NSValue
,NSNumber
or SCMaterialProperty
types.
In the shader, you also need to define the type which you pass. As an example, I might wish to define something like:
uniform vec3 points[100];
Is it really not possible to pass a float array to initialize this uniform?
Otherwise, I thought that maybe it would be possible to store a float3 array as a texture in the SCNMaterialProperty
type and pass this. However, I am unsure about how I might access the individual float3 values in the shader then.
Here are other similar questions I saw that might be relevant:
SceneKit shader modifiers with GLSL arrays
Is it possible to pass a float array to an iOS SceneKit vertex shader modifier?