With our CgInclude file open, we can begin to enter the code that will get it working with our Surface Shaders. The following steps will get our CgInclude file ready for use within our Surface Shaders and allow us to continually add more code to it as we develop more shaders:
- We begin our CgInclude file with what is called a preprocessor directive. These are statements such as #pragma and #include. In this case, we want to define a new set of code that will be executed if our shader includes this file in its compiler directives. Enter the following code at the top of your CgInclude file:
#ifndef MY_CG_INCLUDE #define MY_CG_INCLUDE
- We always need to make sure that we close #ifndef or #ifdef with #endif to close the definition ...