| [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 |  | 
|---|
 | 17 |  | 
|---|
| [5121] | 18 | //-------------- | 
|---|
 | 19 | // Bump mapping | 
|---|
 | 20 | //-------------- | 
|---|
 | 21 |  | 
|---|
 | 22 | // Bump map vertex program, support for this is required | 
|---|
 | 23 | vertex_program BumpMapVP cg | 
|---|
| [5047] | 24 | { | 
|---|
| [5121] | 25 |         source BumpMapping.cg | 
|---|
 | 26 |         entry_point main_vp | 
|---|
 | 27 |         profiles vs_1_1 arbvp1 | 
|---|
 | 28 | } | 
|---|
 | 29 |  | 
|---|
 | 30 | // Bump map fragment program, support for this is optional | 
|---|
 | 31 | fragment_program BumpMapFP cg | 
|---|
 | 32 | { | 
|---|
 | 33 |         source BumpMapping.cg | 
|---|
 | 34 |         entry_point main_fp | 
|---|
 | 35 |         profiles ps_1_1 arbfp1 fp20 | 
|---|
 | 36 | } | 
|---|
 | 37 |  | 
|---|
 | 38 | // Bump map with specular vertex program, support for this is required | 
|---|
 | 39 | vertex_program BumpMapVPSpecular cg | 
|---|
 | 40 | { | 
|---|
 | 41 |         source BumpMapping.cg | 
|---|
 | 42 |         entry_point specular_vp | 
|---|
 | 43 |         profiles vs_1_1 arbvp1 | 
|---|
 | 44 | } | 
|---|
 | 45 |  | 
|---|
 | 46 | // Bump map fragment program, support for this is optional | 
|---|
 | 47 | fragment_program BumpMapFPSpecular cg | 
|---|
 | 48 | { | 
|---|
 | 49 |         source BumpMapping.cg | 
|---|
 | 50 |         entry_point specular_fp | 
|---|
 | 51 |         profiles ps_1_1 arbfp1 fp20 | 
|---|
 | 52 |  | 
|---|
 | 53 |         default_params | 
|---|
 | 54 |         { | 
|---|
 | 55 |         param_named shine float 3 | 
|---|
 | 56 |         } | 
|---|
 | 57 |  | 
|---|
 | 58 | } | 
|---|
 | 59 |  | 
|---|
 | 60 |  | 
|---|
 | 61 | // Any number of lights, diffuse and specular | 
|---|
| [5122] | 62 | material Asteroid/BumpMap | 
|---|
| [5121] | 63 | { | 
|---|
 | 64 |  | 
|---|
 | 65 |         // This is the preferred technique which uses both vertex and | 
|---|
 | 66 |         // fragment programs, supports coloured lights | 
|---|
| [5047] | 67 |         technique | 
|---|
 | 68 |         { | 
|---|
| [5121] | 69 |                 // Base ambient pass | 
|---|
| [5047] | 70 |                 pass | 
|---|
 | 71 |                 { | 
|---|
| [5121] | 72 |                         // base colours, not needed for rendering, but as information | 
|---|
 | 73 |                         // to lighting pass categorisation routine | 
|---|
 | 74 |                         ambient 1 1 1 | 
|---|
 | 75 |                         diffuse 0 0 0 | 
|---|
 | 76 |                         specular 0 0 0 0 | 
|---|
 | 77 |                         // Really basic vertex program | 
|---|
 | 78 |                         // NB we don't use fixed function here because GL does not like | 
|---|
 | 79 |                         // mixing fixed function and vertex programs, depth fighting can | 
|---|
 | 80 |                         // be an issue | 
|---|
 | 81 |                         vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture | 
|---|
 | 82 |                         { | 
|---|
 | 83 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
| [5126] | 84 |                                 param_named ambient float3 0.1 0.1 0.1 | 
|---|
| [5121] | 85 |                         } | 
|---|
 | 86 |  | 
|---|
 | 87 |                 } | 
|---|
 | 88 |                 // Now do the lighting pass | 
|---|
 | 89 |                 // NB we don't do decal texture here because this is repeated per light | 
|---|
 | 90 |                 pass | 
|---|
 | 91 |                 { | 
|---|
 | 92 |                         // base colours, not needed for rendering, but as information | 
|---|
 | 93 |                         // to lighting pass categorisation routine | 
|---|
 | 94 |                         ambient 0 0 0 | 
|---|
 | 95 |                         // do this for each light | 
|---|
 | 96 |                         iteration once_per_light | 
|---|
 | 97 |  | 
|---|
 | 98 |  | 
|---|
 | 99 |                         scene_blend add | 
|---|
 | 100 |  | 
|---|
 | 101 |                         // Vertex program reference | 
|---|
 | 102 |                         vertex_program_ref BumpMapVPSpecular | 
|---|
 | 103 |                         { | 
|---|
 | 104 |                                 param_named_auto lightPosition light_position_object_space 0 | 
|---|
 | 105 |                                 param_named_auto eyePosition camera_position_object_space | 
|---|
 | 106 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
 | 107 |                         } | 
|---|
 | 108 |  | 
|---|
 | 109 |                         // Fragment program | 
|---|
 | 110 |                         fragment_program_ref BumpMapFPSpecular | 
|---|
 | 111 |                         { | 
|---|
 | 112 |                                 param_named_auto lightDiffuse light_diffuse_colour 0 | 
|---|
 | 113 |                                 param_named_auto lightSpecular light_specular_colour 0 | 
|---|
| [5126] | 114 |                                 param_named shine float 4 | 
|---|
| [5121] | 115 |                         } | 
|---|
 | 116 |  | 
|---|
 | 117 |                         // Base bump map | 
|---|
| [5047] | 118 |                         texture_unit | 
|---|
 | 119 |                         { | 
|---|
| [5126] | 120 |                                 texture nmrock.tga | 
|---|
| [5121] | 121 |                                 colour_op replace | 
|---|
 | 122 |                         } | 
|---|
 | 123 |                         // Normalisation cube map | 
|---|
 | 124 |                         texture_unit | 
|---|
 | 125 |                         { | 
|---|
 | 126 |                                 cubic_texture nm.tga combinedUVW | 
|---|
 | 127 |                                 tex_coord_set 1 | 
|---|
 | 128 |                                 tex_address_mode clamp | 
|---|
 | 129 |                         } | 
|---|
 | 130 |                         // Normalisation cube map #2 | 
|---|
 | 131 |                         texture_unit | 
|---|
 | 132 |                         { | 
|---|
 | 133 |                                 cubic_texture nm.tga combinedUVW | 
|---|
 | 134 |                                 tex_coord_set 2 | 
|---|
 | 135 |                                 tex_address_mode clamp | 
|---|
 | 136 |                         } | 
|---|
 | 137 |                 } | 
|---|
 | 138 |  | 
|---|
 | 139 |                 // Decal pass | 
|---|
 | 140 |                 pass | 
|---|
 | 141 |                 { | 
|---|
 | 142 |                         lighting off | 
|---|
 | 143 |                         // Really basic vertex program | 
|---|
 | 144 |                         // NB we don't use fixed function here because GL does not like | 
|---|
 | 145 |                         // mixing fixed function and vertex programs, depth fighting can | 
|---|
 | 146 |                         // be an issue | 
|---|
 | 147 |                         vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture | 
|---|
 | 148 |                         { | 
|---|
 | 149 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
 | 150 |                                 param_named ambient float4 1 1 1 1 | 
|---|
 | 151 |                         } | 
|---|
 | 152 |                         scene_blend dest_colour zero | 
|---|
 | 153 |                         texture_unit | 
|---|
 | 154 |                         { | 
|---|
| [5055] | 155 |                                 texture rock.tga | 
|---|
| [5047] | 156 |                         } | 
|---|
| [5121] | 157 |  | 
|---|
| [5047] | 158 |                 } | 
|---|
| [5121] | 159 |         } | 
|---|
 | 160 |  | 
|---|
 | 161 |         // This is the fallback which cards which don't have fragment program | 
|---|
 | 162 |         // support will use, NB does not support specular colour | 
|---|
 | 163 |         // Note that it still requires vertex program support | 
|---|
 | 164 |         technique | 
|---|
 | 165 |         { | 
|---|
 | 166 |                 // Base ambient pass | 
|---|
| [5047] | 167 |                 pass | 
|---|
 | 168 |                 { | 
|---|
| [5121] | 169 |                         // base colours, not needed for rendering, but as information | 
|---|
 | 170 |                         // to lighting pass categorisation routine | 
|---|
 | 171 |                         ambient 1 1 1 | 
|---|
 | 172 |                         diffuse 0 0 0 | 
|---|
 | 173 |                         specular 0 0 0 0 | 
|---|
 | 174 |                         // Really basic vertex program | 
|---|
 | 175 |                         // NB we don't use fixed function here because GL does not like | 
|---|
 | 176 |                         // mixing fixed function and vertex programs, depth fighting can | 
|---|
 | 177 |                         // be an issue | 
|---|
 | 178 |                         vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture | 
|---|
 | 179 |                         { | 
|---|
 | 180 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
 | 181 |                                 param_named_auto ambient ambient_light_colour | 
|---|
 | 182 |                         } | 
|---|
 | 183 |  | 
|---|
 | 184 |                 } | 
|---|
 | 185 |                 // Now do the lighting pass | 
|---|
 | 186 |                 // NB we don't do decal texture here because this is repeated per light | 
|---|
 | 187 |                 pass | 
|---|
 | 188 |                 { | 
|---|
 | 189 |                         // base colours, not needed for rendering, but as information | 
|---|
 | 190 |                         // to lighting pass categorisation routine | 
|---|
 | 191 |                         ambient 0 0 0 | 
|---|
 | 192 |                         // do this for each light | 
|---|
 | 193 |                         iteration once_per_light | 
|---|
 | 194 |  | 
|---|
 | 195 |  | 
|---|
| [5047] | 196 |                         scene_blend add | 
|---|
| [5121] | 197 |  | 
|---|
 | 198 |                         // Vertex program reference | 
|---|
 | 199 |                         vertex_program_ref BumpMapVP | 
|---|
 | 200 |                         { | 
|---|
 | 201 |                                 param_named_auto lightPosition light_position_object_space 0 | 
|---|
 | 202 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
 | 203 |                         } | 
|---|
 | 204 |  | 
|---|
 | 205 |                         // Base bump map | 
|---|
 | 206 |                         texture_unit | 
|---|
 | 207 |                         { | 
|---|
| [5126] | 208 |                                 texture nmrock.tga | 
|---|
| [5121] | 209 |                                 colour_op replace | 
|---|
 | 210 |                         } | 
|---|
 | 211 |                         // Normalisation cube map, with dot product on bump map | 
|---|
 | 212 |                         texture_unit | 
|---|
 | 213 |                         { | 
|---|
 | 214 |                                 cubic_texture nm.tga combinedUVW | 
|---|
 | 215 |                                 tex_coord_set 1 | 
|---|
 | 216 |                                 tex_address_mode clamp | 
|---|
 | 217 |                                 colour_op_ex dotproduct src_texture src_current | 
|---|
 | 218 |                                 colour_op_multipass_fallback dest_colour zero | 
|---|
 | 219 |                         } | 
|---|
| [5047] | 220 |                 } | 
|---|
| [5121] | 221 |  | 
|---|
 | 222 |                 // Decal pass | 
|---|
 | 223 |                 pass | 
|---|
 | 224 |                 { | 
|---|
 | 225 |                         lighting off | 
|---|
 | 226 |                         // Really basic vertex program | 
|---|
 | 227 |                         // NB we don't use fixed function here because GL does not like | 
|---|
 | 228 |                         // mixing fixed function and vertex programs, depth fighting can | 
|---|
 | 229 |                         // be an issue | 
|---|
 | 230 |                         vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture | 
|---|
 | 231 |                         { | 
|---|
 | 232 |                                 param_named_auto worldViewProj worldviewproj_matrix | 
|---|
 | 233 |                                 param_named ambient float4 1 1 1 1 | 
|---|
 | 234 |                         } | 
|---|
 | 235 |                         scene_blend dest_colour zero | 
|---|
 | 236 |                         texture_unit | 
|---|
 | 237 |                         { | 
|---|
 | 238 |                                 texture rock.tga | 
|---|
 | 239 |                         } | 
|---|
 | 240 |  | 
|---|
 | 241 |                 } | 
|---|
 | 242 |  | 
|---|
| [5047] | 243 |         } | 
|---|
 | 244 | } | 
|---|
| [5121] | 245 |  | 
|---|
 | 246 |  | 
|---|
 | 247 |  | 
|---|