Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2018, 1:06:05 PM (5 years ago)
Author:
wiesep
Message:

Updated programs and adjusted Material to work with GLSL>150

File:
1 edited

Legend:

Unmodified
Added
Removed
  • data/branches/Shader_HS18/materials/Cube_Lava_Normal.material

    r12088 r12091  
    1 //------------------------
    2 // Basic
    3 //------------------------
    4 
    5 //---------------------------------------------------
    6 // This file includes a number of basic GPU programs
    7 // for use in many materials.
    8 //---------------------------------------------------
    9 
    10 
    11 // A really basic ambient pass program, support for one texture coordinate set
    12 vertex_program AmbientOneTextureCg cg
    13 {
    14     source Example_Basic.cg
    15     entry_point ambientOneTexture_vp
    16     profiles vs_1_1 arbvp1
    17 
    18     default_params
    19     {
    20         param_named_auto worldViewProj worldviewproj_matrix
    21         param_named_auto ambient ambient_light_colour
    22     }
    23 
    24 }
    25 
    26 vertex_program AmbientOneTextureCgSm4 cg
    27 {
    28     source Example_Basic_sm4.cg
    29     entry_point ambientOneTexture_vp
    30     profiles vs_4_0
    31 
    32     default_params
    33     {
    34         param_named_auto worldViewProj worldviewproj_matrix
    35         param_named_auto ambient ambient_light_colour
    36     }
    37 
    38 }
    39 
    40 // A really basic ambient pass program, support for one texture coordinate set
    41 vertex_program AmbientOneTextureHLSL hlsl
    42 {
    43     source Example_Basic.hlsl
    44     entry_point ambientOneTexture_vp
    45     target vs_4_0
    46 
    47     default_params
    48     {
    49         param_named_auto worldViewProj worldviewproj_matrix
    50         param_named_auto ambient ambient_light_colour
    51     }
    52 }
    53 // A really basic ambient pass program, support for one texture coordinate set
    54 vertex_program AmbientOneTextureGLSL glsl
    55 {
    56     source AmbientOneTexture.glsl
    57 }
    58 
    59 // A really basic ambient pass program, support for one texture coordinate set
    60 vertex_program AmbientOneTextureGLSL glsl
    61 {
    62     source AmbientOneTexture.glsl
    63    
    64 
    65     default_params
    66     {
    67         param_named_auto ambient ambient_light_colour
    68         param_named_auto worldViewProj worldviewproj_matrix
    69     }
    70 }
    71 
    72 // A really basic ambient pass program, support for one texture coordinate set
    73 vertex_program AmbientOneTextureGLSLES glsles
    74 {
    75     source AmbientOneTexture.glsles
    76 
    77     default_params
    78     {
    79         param_named_auto worldViewProj worldviewproj_matrix
    80         param_named_auto ambient ambient_light_colour
    81     }
    82 }
    83 
    84 vertex_program AmbientOneTextureWithUVGLSLES glsles
    85 {
    86     source AmbientOneTextureWithUV.glsles
    87 
    88     default_params
    89     {
    90         param_named_auto worldViewProj worldviewproj_matrix
    91         param_named_auto ambient ambient_light_colour
    92     }
    93 }
    94 
    95 vertex_program AmbientOneTextureWithUVGLSL glsl
    96 {
    97     source AmbientOneTextureWithUV.glsl
    98    
    99 
    100     default_params
    101     {
    102         param_named_auto worldViewProj worldviewproj_matrix
    103         param_named_auto ambient ambient_light_colour
    104     }
    105 }
    106 
    107 vertex_program AmbientOneTextureWithUV unified
    108 {
    109     delegate AmbientOneTextureWithUVGLSL
    110     delegate AmbientOneTextureWithUVGLSLES
    111     delegate AmbientOneTextureHLSL
    112     delegate AmbientOneTextureCg
    113     delegate AmbientOneTextureCgSm4
    114 }
    115 
    116 vertex_program AmbientOneTextureUnified unified
    117 {
    118     delegate AmbientOneTextureGLSL
    119     delegate AmbientOneTextureGLSLES
    120     delegate AmbientOneTextureHLSL
    121     delegate AmbientOneTextureCg
    122     delegate AmbientOneTextureCgSm4
    123 }
    124 
    125 fragment_program DiffuseOneTextureCg cg
    126 {
    127     source Example_Basic.cg
    128     entry_point diffuseOneTexture_fp
    129     profiles ps_2_0 arbfp1
    130 }
    131 
    132 fragment_program DiffuseOneTextureGLSLES glsles
    133 {
    134     source DiffuseOneTexture.glsles
    135     default_params
    136     {
    137         param_named texMap int 0
    138     }
    139 }
    140 
    141 fragment_program DiffuseOneTextureGLSL glsl
    142 {
    143     source DiffuseOneTexture.glsl
    144     default_params
    145     {
    146         param_named texMap int 0
    147     }
    148 }
    149 
    150 fragment_program DiffuseOneTexture unified
    151 {
    152     delegate DiffuseOneTextureGLSL
    153     delegate DiffuseOneTextureGLSLES
    154     delegate DiffuseOneTextureCg
    155 }
    156 
    157 // A really basic ambient pass program, support for one texture coordinate set
    158 fragment_program PassthroughFP unified
    159 {
    160     delegate PassthroughFpGLSL
    161     delegate PassthroughFpGLSLES
    162     delegate PassthroughFpCgSm4
    163     delegate PassthroughFpCg
    164 }
    165 
    166 // A really basic ambient pass program, support for one texture coordinate set
    167 fragment_program PassthroughFpCgSm4 cg
    168 {
    169     entry_point main
    170     source PassthroughFP_sm4.cg
    171     profiles ps_4_0
    172 }
    173 
    174 fragment_program PassthroughFpCg cg
    175 {
    176     entry_point mainCg
    177     source PassthroughFP.cg
    178     profiles ps_2_0 arbfp1
    179 }
    180 
    181 // A really basic ambient pass program, support for one texture coordinate set
    182 fragment_program PassthroughFpCgSm4ForAmbientOneTexture cg
    183 {
    184     entry_point mainForAmbientOneTexture
    185     source PassthroughFP_sm4.cg
    186     profiles ps_4_0
    187 }
    188 
    189 
    190 // A really basic ambient pass program, support for one texture coordinate set
    191 fragment_program PassthroughFpGLSLES glsles
    192 {
    193     source PassthroughFP.glsles
    194 }
    195 
    196 fragment_program PassthroughFpGLSL glsl
    197 {
    198     source PassthroughFP.glsl
    199 }
    200 
    201 //------------------------
    202 // Bump mapping section
    203 //------------------------
    204 
    205 // Bump map vertex program, support for this is required
    206 vertex_program Lava/BumpMapVPCg cg
    207 {
    208     source Example_BumpMapping.cg
    209     entry_point main_vp
    210     profiles vs_4_0 vs_1_1 arbvp1
    211 }
    212 
    213 vertex_program Lava/BumpMapVPGLSLES glsles
    214 {
    215     source Example_BumpMappingVp.glsles
    216     profiles glsles
    217 }
    218 
    219 vertex_program Lava/BumpMapVPGLSL glsl
    220 {
    221     source Example_BumpMappingVp.glsl
    222 }
    223 
    224 vertex_program Lava/BumpMapVP unified
    225 {
    226     delegate Lava/BumpMapVPGLSL
    227     delegate Lava/BumpMapVPGLSLES
    228     delegate Lava/BumpMapVPCg
    229 }
    230 
    231 // Bump map vertex program, with tangent parity support for this is required
    232 vertex_program Lava/BumpMapVPTangentParityCg cg
    233 {
    234     source Example_BumpMapping.cg
    235     entry_point main_vp
    236     profiles vs_1_1 arbvp1
    237     compile_arguments -DTANGENTS_HAVE_PARITY=1
    238 }
    239 
    240 // Bump map vertex program, with tangent parity support for this is required
    241 vertex_program Lava/BumpMapVPTangentParityGLSLES glsles
    242 {
    243     source BumpMapVPTangentParity.glsles
    244 }
    245 
    246 vertex_program Lava/BumpMapVPTangentParityGLSL glsl
    247 {
    248     source BumpMapVPTangentParity.glsl
    249     default_params
    250     {
    251         param_named_auto lightDiffuse light_diffuse_colour 0
    252     }
    253 }
    254 
    255 vertex_program Lava/BumpMapVPTangentParity unified
    256 {
    257     delegate Lava/BumpMapVPTangentParityGLSL
    258     delegate Lava/BumpMapVPTangentParityGLSLES
    259     delegate Lava/BumpMapVPTangentParityCg
    260 }
    261 
    262 // Bump map fragment program, support for this is optional
    263 fragment_program Lava/BumpMapFPCg cg
    264 {
    265     source Example_BumpMapping.cg
    266     entry_point main_fp
    267     profiles ps_4_0 ps_2_0 arbfp1 fp20
    268 }
    269 
    270 fragment_program Lava/BumpMapFPGLSLES glsles
    271 {
    272     source Example_BumpMappingFp.glsles
    273     profiles glsles
    274     default_params
    275     {
    276         // assign samplers as required by GLSL
    277         param_named normalMap int 0
    278     }
    279 }
    280 
    281 fragment_program Lava/BumpMapFPGLSL glsl
    282 {
    283     source Example_BumpMappingFp.glsl
    284     default_params
    285     {
    286         // assign samplers as required by GLSL
    287         param_named normalMap int 0
    288     }
    289 }
    290 
    291 fragment_program Lava/BumpMapFP unified
    292 {
    293     delegate Lava/BumpMapFPGLSL
    294     delegate Lava/BumpMapFPGLSLES
    295     delegate Lava/BumpMapFPCg
    296 }
    297 
    298 // Bump map vertex program shadow receiver
    299 vertex_program Lava/BumpMapVPShadowRcvCg cg
    300 {
    301     source Example_BumpMapping.cg
    302     entry_point main_shadowreceiver_vp
    303     profiles vs_1_1 arbvp1
    304 }
    305 
    306 // Bump map vertex program shadow receiver
    307 vertex_program Lava/BumpMapVPShadowRcvGLSLES glsles
    308 {
    309     source Example_BumpMappingShadowRcvVp.glsles
    310     profiles glsles
    311 }
    312 
    313 vertex_program Lava/BumpMapVPShadowRcvGLSL glsl
    314 {
    315     source Example_BumpMappingShadowRcvVp.glsl
    316 
    317 }
    318 
    319 vertex_program Lava/BumpMapVPShadowRcv unified
    320 {
    321     delegate Lava/BumpMapVPShadowRcvGLSL
    322     delegate Lava/BumpMapVPShadowRcvGLSLES
    323     delegate Lava/BumpMapVPShadowRcvCg
    324 }
    325 
    326 // Bump map fragment program shadow receiver, support for this is optional
    327 fragment_program Lava/BumpMapFPShadowRcvCg cg
    328 {
    329     source Example_BumpMapping.cg
    330     entry_point main_shadowreceiver_fp
    331     profiles ps_2_0 arbfp1 fp20
    332 }
    333 
    334 // Bump map fragment program shadow receiver, support for this is optional
    335 fragment_program Lava/BumpMapFPShadowRcvGLSLES glsles
    336 {
    337     source Example_BumpMappingShadowRcvFp.glsles
    338     profiles glsles
    339     default_params
    340     {
    341         // assign samplers as required by GLSL
    342         param_named shadowMap int 0
    343         param_named normalMap int 1
    344     }
    345 }
    346 
    347 fragment_program Lava/BumpMapFPShadowRcvGLSL glsl
    348 {
    349     source Example_BumpMappingShadowRcvFp.glsl
    350     default_params
    351     {
    352         // assign samplers as required by GLSL
    353         param_named shadowMap int 0
    354         param_named normalMap int 1
    355     }
    356 }
    357 
    358 fragment_program Lava/BumpMapFPShadowRcv unified
    359 {
    360     delegate Lava/BumpMapFPShadowRcvGLSL
    361     delegate Lava/BumpMapFPShadowRcvGLSLES
    362     delegate Lava/BumpMapFPShadowRcvCg
    363 }
    364 
    365 // Bump map with specular vertex program, support for this is required
    366 vertex_program Lava/BumpMapVPSpecularCg cg
    367 {
    368     source Example_BumpMapping.cg
    369     entry_point specular_vp
    370     profiles vs_4_0 vs_1_1 arbvp1
    371 }
    372 
    373 // Bump map with specular vertex program, support for this is required
    374 vertex_program Lava/BumpMapVPSpecularGLSLES glsles
    375 {
    376     source Example_BumpMappingSpecularVp.glsles
    377     profiles glsles
    378 }
    379 
    380 vertex_program Lava/BumpMapVPSpecularGLSL glsl
    381 {
    382     source Example_BumpMappingSpecularVp.glsl
    383 }
    384 
    385 vertex_program Lava/BumpMapVPSpecular unified
    386 {
    387     delegate Lava/BumpMapVPSpecularGLSL
    388     delegate Lava/BumpMapVPSpecularGLSLES
    389     delegate Lava/BumpMapVPSpecularCg
    390 }
    391 
    392 // Bump map fragment program, support for this is optional
    393 fragment_program Lava/BumpMapFPSpecularCg cg
    394 {
    395     source Example_BumpMapping.cg
    396     entry_point specular_fp
    397     profiles ps_4_0 ps_2_0 arbfp1 fp20
    398 }
    399 
    400 // Bump map fragment program, support for this is optional
    401 fragment_program Lava/BumpMapFPSpecularGLSLES glsles
    402 {
    403     source Example_BumpMappingSpecularFp.glsles
    404     profiles glsles
    405     default_params
    406     {
    407         // assign samplers as required by GLSL
    408         param_named normalMap int 0
    409     }
    410 }
    411 
    412 fragment_program Lava/BumpMapFPSpecularGLSL glsl
    413 {
    414     source Example_BumpMappingSpecularFp.glsl
    415     default_params
    416     {
    417         // assign samplers as required by GLSL
    418         param_named normalMap int 0
    419     }
    420 }
    421 
    422 fragment_program Lava/BumpMapFPSpecular unified
    423 {
    424     delegate Lava/BumpMapFPSpecularGLSL
    425     delegate Lava/BumpMapFPSpecularGLSLES
    426     delegate Lava/BumpMapFPSpecularCg
    427 }
    428 
    429 //------------------------
    430 // Material
    431 //------------------------
    432 
    4331// Any number of lights, diffuse
    4342material Cube_Lava_Normal
    4353{
    436 
    437     // This is the preferred technique which uses both vertex and
    438     // fragment programs, supports coloured lights
    4394    technique
    4405    {
     
    4449            // base colours, not needed for rendering, but as information
    44510            // to lighting pass categorisation routine
    446             ambient 1 1 1
    447             diffuse 0 0 0
    448             specular 0 0 0 0
    449             // Really basic vertex program
    450             // NB we don't use fixed function here because GL does not like
    451             // mixing fixed function and vertex programs, depth fighting can
    452             // be an issue
    453             vertex_program_ref AmbientOneTextureUnified
    454             {
    455                 param_named_auto ambient ambient_light_colour
    456             }
    457             fragment_program_ref PassthroughFP
    458             {
    459             }
    460            
     11            diffuse 0 0 0
    46112        }
    46213        // Now do the lighting pass
     
    46415        pass perlight
    46516        {
     17            // do this for each light
     18            iteration once_per_light
     19            scene_blend add
     20
    46621            // base colours, not needed for rendering, but as information
    46722            // to lighting pass categorisation routine
    468             ambient 0 0 0
    469            
    470             // do this for each light
    471             iteration once_per_light
    472 
    473        
    474             scene_blend add
     23            ambient 0 0 0
    47524
    47625            // Vertex program reference
    477             vertex_program_ref Lava/BumpMapVP
     26            vertex_program_ref Examples/BumpMapVP
    47827            {
    47928                param_named_auto lightPosition light_position_object_space 0
     
    48231
    48332            // Fragment program
    484             fragment_program_ref Lava/BumpMapFP
     33            fragment_program_ref Examples/BumpMapFP
    48534            {
    48635                param_named_auto lightDiffuse light_diffuse_colour 0
     
    48837
    48938            // texture shadow receiver program
    490             shadow_receiver_vertex_program_ref Lava/BumpMapVPShadowRcv
     39            shadow_receiver_vertex_program_ref Examples/BumpMapVPShadowRcv
    49140            {
    49241                param_named_auto lightPosition light_position_object_space 0
     
    49645            }
    49746            // Additive texture shadow receiver program
    498             shadow_receiver_fragment_program_ref Lava/BumpMapFPShadowRcv
     47            shadow_receiver_fragment_program_ref Examples/BumpMapFPShadowRcv
    49948            {
    50049                param_named_auto lightDiffuse light_diffuse_colour 0
     
    50554            {
    50655                texture Cube_Lava_NORM.jpg
    507                 tex_address_mode wrap
    508                 scale 1.0 1.0
    50956                colour_op replace
    51057            }
    511 
    51258        }
    51359       
     
    51561        pass decal
    51662        {
    517             // base colours, not needed for rendering, but as information
    518             // to lighting pass categorisation routine
     63            // hint to pass categorisation routine, that this is decal only
    51964            lighting off
    520             // Really basic vertex program
    521             // NB we don't use fixed function here because GL does not like
    522             // mixing fixed function and vertex programs, depth fighting can
    523             // be an issue
    524             vertex_program_ref AmbientOneTextureUnified
    525             {
    526                 param_named_auto worldViewProj worldviewproj_matrix
    527                 param_named ambient float4 1 1 1 1
    528             }
    529             fragment_program_ref PassthroughFP
    530             {
    531             }
    532 
    53365            scene_blend dest_colour zero
    534             texture_unit
    535             {
    536                 texture Cube_Lava_NORM.jpg
    537                 tex_address_mode wrap
    538                 scale 1.0 1.0
    539                 colour_op modulate
    540             }
    541 
    542            
    543         }
    544 
    545       pass Cube_Lava
    546         {
    547             ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0
    548             diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0
    549             specular 0.5 0.5 0.5 1.0 12.5
    550             emissive 0.0 0.0 0.0 1.0
    551 
    552             alpha_to_coverage off
    553             colour_write on
    554             cull_hardware clockwise
    555             depth_check on
    556             depth_func less_equal
    557             depth_write on
    558             illumination_stage
    559             light_clip_planes off
    560             light_scissor off
    561             lighting on
    562             normalise_normals off
    563             polygon_mode solid
    564             scene_blend one zero
    565             scene_blend_op add
    566             shading gouraud
    567             transparent_sorting on
    568 
    569             texture_unit
    570             {
    571                 texture Cube_Lava_COLOR.jpg
    572                 tex_address_mode wrap
    573                 scale 1.0 1.0
    574                 colour_op modulate
    575             }
     66            ambient 0.5 0.5 0.5 1
    57667        }
    57768    }
    578 
    579 
    58069}
Note: See TracChangeset for help on using the changeset viewer.