| 1 | |
|---|
| 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 | // A really basic ambient pass program, support for one texture coodinate set |
|---|
| 18 | vertex_program Ogre/BasicVertexPrograms/AmbientOneTextureGLSL glsl |
|---|
| 19 | { |
|---|
| 20 | source AmbientOneTexture.glsl |
|---|
| 21 | |
|---|
| 22 | default_params |
|---|
| 23 | { |
|---|
| 24 | param_named_auto ambient ambient_light_colour |
|---|
| 25 | } |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | //-------------- |
|---|
| 30 | // Bump mapping |
|---|
| 31 | //-------------- |
|---|
| 32 | |
|---|
| 33 | // Bump map vertex program, support for this is required |
|---|
| 34 | vertex_program BumpMapVP cg |
|---|
| 35 | { |
|---|
| 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 |
|---|
| 73 | material Asteroid/BumpMap |
|---|
| 74 | { |
|---|
| 75 | |
|---|
| 76 | // This is the preferred technique which uses both vertex and |
|---|
| 77 | // fragment programs, supports coloured lights |
|---|
| 78 | technique |
|---|
| 79 | { |
|---|
| 80 | // Base ambient pass |
|---|
| 81 | pass |
|---|
| 82 | { |
|---|
| 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 |
|---|
| 92 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
|---|
| 93 | { |
|---|
| 94 | param_named_auto worldViewProj worldviewproj_matrix |
|---|
| 95 | param_named ambient float3 0.1 0.1 0.1 |
|---|
| 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 |
|---|
| 125 | param_named shine float 4 |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | // Base bump map |
|---|
| 129 | texture_unit |
|---|
| 130 | { |
|---|
| 131 | texture nmrock.tga |
|---|
| 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 |
|---|
| 158 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
|---|
| 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 | { |
|---|
| 166 | texture rock.tga |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | } |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | |
|---|