Results 1 to 2 of 2

Thread: FX SID resolution

  1. #1

    FX SID resolution

    The rules for resolving SIDs, and FX SIDs in particular, are not very clear. With regard to FX SIDs in particular, how do I know at which element to start the search for a particular SID? Consider, for example, the "texture" atttibute of <texture> element:

    Code :
    		<effect id="Scene_Material_fx">
    			<profile_COMMON>
    				<newparam sid="acorn_png_surface">
    					<surface type="2D">
    						<init_from>acorn_png_img</init_from>
    					</surface>
    				</newparam>
    				<newparam sid="acorn_png_sampler">
    					<sampler2D>
    						<source>acorn_png_surface</source>
    					</sampler2D>
    				</newparam>
    				<technique sid="default">
    					<phong>
    						...
    						<diffuse>
    							<texture texture="acorn_png_sampler" texcoord="diffuse_TEXCOORD"></texture>
    						</diffuse>
    						...
    				</phong>
    				</technique>
    			</profile_COMMON>
    		</effect>

    I can find the SID referenced by texture if I start the search at <profile_COMMON>, which is the great-great-grandparent of the <texture> element that contains the reference. How, then, is the ID of this starting element determined? Is it defined somewhere in the spec?

    Is there a limit to how close to the document root the sid referenced by a particular <texture> element may be found? In the above example, could it possibly appear outside of <profile_COMMON>, such as inside its <effect> parent? Which is the "rootmost" element at which I am guaranteed to find the referenced sid by drilling down from that element?

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: FX SID resolution

    FX parameters are explained in Chapter 7 of the 1.5 specification, section "About Parameters in FX".

    FX parameters are bindable in the scope they are declared, and in any child scopes for that <effect> or profile.

    In your example the texture attribute would resolve to a parameter in the profile scope. I.e. in the nearest in scope to itself, which must be (because of the schema) in the parent profile scope or, failing that, the parent effect scope.

    Note: Both the texture and texcoord attributes are semantic tokens, not <sidref_type>.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •