Wednesday, 15 July 2015

ios - How to write in a new shader file in SceneKit: consecutive statements on a line must be separated by ;? -


I'm starting with SceneKit and shaders, I created a fast file, changed its name to its name. Shader, and I added this:

  Uniform sample is 2D RTBL; // This horizontal blot should be changed by changing the VC2 vTexCoord to the text provided; Const Float Blur Size = 1.0 / 512.0; Zodiac + = Texture 2D (RTLR, vC2 (vTexCoord.x, vTexCoord.y - 4.0 * Blur Size)) * 0.05; Zodiac + = Texture 2D (RTLL, VTexCoord.y - 3.0 * Blur Size) * 0.09; Zodiac + = Texture 2D (RTL, VTexCoord.y - 2.0 * Blur Size)) * 0.12; Zodiac + = Texture 2D (vTexCoord.x, vTexCoord.y - blurSize)) * 0.15; Zodiac + = Texture 2D (vTexCoord.x, vTexCoord.y)) * 0.16; Yoga + = Texture 2D (RTLL, vTexCoord.x, vTexCoord.y + Blur Size) * 0.15; Zodiac + = Texture 2D (RTLL, VTexCoord.y + 2.0 * Blur Size) * 0.12; Zodiac + = Texture 2D (RTLL, VTexCoord.y + 3.0 * Blur Size) * 0.09; Zodiac + = texture 2d (rtblr, vc 2 (vTexCoord.x, vTexCoord.y + 4.0 * blur size)) * 0.05; Gl_FragColor = sum; Blue Tutorial  

But I get 3 errors on 3 first rows: It asks me to add a ; :

Enter image details here

I have not understood the problem

thanks

I created a fast file It has changed its name to MyFragment.shader

This is your problem.

When you add a file to your project, Xcode determines what kind of file this is. If you make SWIFT files, then it will compile with Swift Compiler. (And the swift compiler will not expect to write the contents of that file in Swift, not GLSL.)

You do not want to compile your shaders as a native (CPU) source when your app runs So by OpenLL the shader (for the GPU) is compiled, so that you copy them to your bundle and send it to GL (in your case via the sineaket), when you are ready to use them Be the first one.

The file processing rules in your project are not automatically changed when you rename the file type extension. (This is because you can use a different extension than the default of Xcode for some file types.) So, here are two fixes for two different references:

Build for an existing file Change the rules

Whatever you've got, you probably do not want to recreate some parts of your project, you just want to tell Zedod to treat your shader as a shader, Swift source In the Select your project in the Navigator, go to the Build phase and myFragment.shader Copy to copy the compiled sources bundle resources.

Enter image details here

Add a new file right Creating Rules

You can avoid the above after creating new shader files If you create a new file by using the empty file template, then it is already bundled with the resource Will be considered as a form, so you do not need to do anything further.

Enter image details here

Similarly, if you .shader or .fsh or .vsh (or actually anything that is not SWIFT / C / OBJC / etc source file) your project , Which will be considered as bundled processing by default.


No comments:

Post a Comment