## ## Copyright (c) 2005 PIXAR. All rights reserved. This program or ## documentation contains proprietary confidential information and trade ## secrets of PIXAR. Reverse engineering of object code is prohibited. ## Use of copyright notice is precautionary and does not imply ## publication. ## ## RESTRICTED RIGHTS NOTICE ## ## Use, duplication, or disclosure by the Government is subject to the ## following restrictions: For civilian agencies, subparagraphs (a) through ## (d) of the Commercial Computer Software--Restricted Rights clause at ## 52.227-19 of the FAR; and, for units of the Department of Defense, DoD ## Supplement to the FAR, clause 52.227-7013 (c)(1)(ii), Rights in ## Technical Data and Computer Software. ## ## Pixar Animation Studios ## 1200 Park Ave ## Emeryville, CA 94608 ## ## ## Switch ## A simple generative function that switches between two inputs ## slim 1 extensions pixartt { extensions pixar pxsl { template float Switch { description { Switch between two inputs } parameter float Input0 { label "Input 0" detail varying default 0 } parameter float Input1 { label "Input 1" detail varying default 0 } parameter float Which { label "Which Input" detail uniform range {0 1 1} default 0 } parameter float result { access output display hidden } RSLSource GenerativeFunction { proc primvars {} {} proc function {} { generateBody { output "if (Which > 0.5)" output "{" indent set var1 [generate Input1] output "result = $var1;" exdent output "}" output "else" output "{" indent set var0 [generate Input0] output "result = $var0;" exdent output "}" } } } } } }