[5121] | 1 | |
---|
[5131] | 2 | // A really basic ambient pass program, support for one texture coodinate set |
---|
| 3 | vertex_program Ogre/BasicVertexPrograms/AmbientOneTexture cg |
---|
| 4 | { |
---|
| 5 | source Example_Basic.cg |
---|
| 6 | entry_point ambientOneTexture_vp |
---|
| 7 | profiles vs_1_1 arbvp1 |
---|
| 8 | |
---|
| 9 | default_params |
---|
| 10 | { |
---|
| 11 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 12 | param_named_auto ambient ambient_light_colour |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | } |
---|
| 16 | |
---|
[5132] | 17 | // A really basic ambient pass program, support for one texture coodinate set |
---|
| 18 | vertex_program Ogre/BasicVertexPrograms/AmbientOneTextureGLSL glsl |
---|
| 19 | { |
---|
| 20 | source AmbientOneTexture.glsl |
---|
[5131] | 21 | |
---|
[5132] | 22 | default_params |
---|
| 23 | { |
---|
| 24 | param_named_auto ambient ambient_light_colour |
---|
| 25 | } |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | |
---|
[5121] | 29 | //-------------- |
---|
| 30 | // Bump mapping |
---|
| 31 | //-------------- |
---|
| 32 | |
---|
| 33 | // Bump map vertex program, support for this is required |
---|
| 34 | vertex_program BumpMapVP cg |
---|
[5047] | 35 | { |
---|
[5121] | 36 | source BumpMapping.cg |
---|
| 37 | entry_point main_vp |
---|
| 38 | profiles vs_1_1 arbvp1 |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | // Bump map fragment program, support for this is optional |
---|
| 42 | fragment_program BumpMapFP cg |
---|
| 43 | { |
---|
| 44 | source BumpMapping.cg |
---|
| 45 | entry_point main_fp |
---|
| 46 | profiles ps_1_1 arbfp1 fp20 |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | // Bump map with specular vertex program, support for this is required |
---|
| 50 | vertex_program BumpMapVPSpecular cg |
---|
| 51 | { |
---|
| 52 | source BumpMapping.cg |
---|
| 53 | entry_point specular_vp |
---|
| 54 | profiles vs_1_1 arbvp1 |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | // Bump map fragment program, support for this is optional |
---|
| 58 | fragment_program BumpMapFPSpecular cg |
---|
| 59 | { |
---|
| 60 | source BumpMapping.cg |
---|
| 61 | entry_point specular_fp |
---|
| 62 | profiles ps_1_1 arbfp1 fp20 |
---|
| 63 | |
---|
| 64 | default_params |
---|
| 65 | { |
---|
| 66 | param_named shine float 3 |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | // Any number of lights, diffuse and specular |
---|
[5122] | 73 | material Asteroid/BumpMap |
---|
[5121] | 74 | { |
---|
| 75 | |
---|
| 76 | // This is the preferred technique which uses both vertex and |
---|
| 77 | // fragment programs, supports coloured lights |
---|
[5047] | 78 | technique |
---|
| 79 | { |
---|
[5121] | 80 | // Base ambient pass |
---|
[5047] | 81 | pass |
---|
| 82 | { |
---|
[5121] | 83 | // base colours, not needed for rendering, but as information |
---|
| 84 | // to lighting pass categorisation routine |
---|
| 85 | ambient 1 1 1 |
---|
| 86 | diffuse 0 0 0 |
---|
| 87 | specular 0 0 0 0 |
---|
| 88 | // Really basic vertex program |
---|
| 89 | // NB we don't use fixed function here because GL does not like |
---|
| 90 | // mixing fixed function and vertex programs, depth fighting can |
---|
| 91 | // be an issue |
---|
[5132] | 92 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
---|
[5121] | 93 | { |
---|
| 94 | param_named_auto worldViewProj worldviewproj_matrix |
---|
[5126] | 95 | param_named ambient float3 0.1 0.1 0.1 |
---|
[5121] | 96 | } |
---|
| 97 | |
---|
| 98 | } |
---|
| 99 | // Now do the lighting pass |
---|
| 100 | // NB we don't do decal texture here because this is repeated per light |
---|
| 101 | pass |
---|
| 102 | { |
---|
| 103 | // base colours, not needed for rendering, but as information |
---|
| 104 | // to lighting pass categorisation routine |
---|
| 105 | ambient 0 0 0 |
---|
| 106 | // do this for each light |
---|
| 107 | iteration once_per_light |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | scene_blend add |
---|
| 111 | |
---|
| 112 | // Vertex program reference |
---|
| 113 | vertex_program_ref BumpMapVPSpecular |
---|
| 114 | { |
---|
| 115 | param_named_auto lightPosition light_position_object_space 0 |
---|
| 116 | param_named_auto eyePosition camera_position_object_space |
---|
| 117 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | // Fragment program |
---|
| 121 | fragment_program_ref BumpMapFPSpecular |
---|
| 122 | { |
---|
| 123 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
| 124 | param_named_auto lightSpecular light_specular_colour 0 |
---|
[5126] | 125 | param_named shine float 4 |
---|
[5121] | 126 | } |
---|
| 127 | |
---|
| 128 | // Base bump map |
---|
[5047] | 129 | texture_unit |
---|
| 130 | { |
---|
[5126] | 131 | texture nmrock.tga |
---|
[5121] | 132 | colour_op replace |
---|
| 133 | } |
---|
| 134 | // Normalisation cube map |
---|
| 135 | texture_unit |
---|
| 136 | { |
---|
| 137 | cubic_texture nm.tga combinedUVW |
---|
| 138 | tex_coord_set 1 |
---|
| 139 | tex_address_mode clamp |
---|
| 140 | } |
---|
| 141 | // Normalisation cube map #2 |
---|
| 142 | texture_unit |
---|
| 143 | { |
---|
| 144 | cubic_texture nm.tga combinedUVW |
---|
| 145 | tex_coord_set 2 |
---|
| 146 | tex_address_mode clamp |
---|
| 147 | } |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | // Decal pass |
---|
| 151 | pass |
---|
| 152 | { |
---|
| 153 | lighting off |
---|
| 154 | // Really basic vertex program |
---|
| 155 | // NB we don't use fixed function here because GL does not like |
---|
| 156 | // mixing fixed function and vertex programs, depth fighting can |
---|
| 157 | // be an issue |
---|
[5132] | 158 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
---|
[5121] | 159 | { |
---|
| 160 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 161 | param_named ambient float4 1 1 1 1 |
---|
| 162 | } |
---|
| 163 | scene_blend dest_colour zero |
---|
| 164 | texture_unit |
---|
| 165 | { |
---|
[5055] | 166 | texture rock.tga |
---|
[5047] | 167 | } |
---|
[5121] | 168 | |
---|
[5047] | 169 | } |
---|
[5121] | 170 | } |
---|
| 171 | |
---|
[5047] | 172 | } |
---|
[5121] | 173 | |
---|
| 174 | |
---|
| 175 | |
---|