[Introduction to Pass in Unity Shader_Part 4]

The story begins in the previous article

1.1. Structure (struct structure and abbreviated meaning of structure name and variable name)

a. Structural syntax

A structure allows storing multiple variables of different types, and packaging multiple variables into a whole for input or output.
The structure is as follows:

	struct Type
	{
   
    
    
		//变量 _1;
		//变量 _2;
		//变量 _3;
		//变量 _4;
	}

struct: A keyword defining a structure.
Type: Define a type for the current structure, which will be used when the shader function defines the input and output data types. The variables contained in the structure still need to define the data type and name, and then fill in the corresponding semantics. Finally, it is accessed through the syntax of [structure name].[variable name],
for example: v.vertex, which means accessing the vertex variable in the structure with the name v.

b. Structure application

After getting a general understanding of how to use the structure, then rewrite the 1.3. Shader in the third part of Pass to use the structure as the

Guess you like

Origin blog.csdn.net/xukaibo111/article/details/124245319#comments_26601876