Example #1
0
        public override void doIt(MArgList argList)
        {
            MArgDatabase argData = new MArgDatabase(syntax, argList);

            // Retrieve pass Id. The pass flag must be set.
            string passId = argData.isFlagSet(PassFlag[0]) ? argData.flagArgumentString(PassFlag[0], 0) : "";

            if (passId.Length <= 0)
            {
                throw new System.ArgumentException("The pass flag is not set", "argList");
            }

            MRenderPassDef def = null;

            try {
                def = MRenderPassRegistry.getRenderPassDefinition(passId);
            } catch (System.Exception) {
                setResult(false);
                return;
            }

            // implementation information
            string renderer = argData.isFlagSet(RendererFlag[0]) ? argData.flagArgumentString(RendererFlag[0], 0) : "";

            if (renderer.Length > 0)
            {
                MPxRenderPassImpl impl = null;
                try {
                    impl = def.getImplementation(renderer);
                } catch (System.Exception) {
                    // impl info requested but does not exist, stop here
                    setResult(false);
                    return;
                }

                if (argData.isFlagSet(TypesFlag[0]))
                {
                    uint   types  = impl.typesSupported();
                    string result = getTypeStrings(types);
                    setResult(result);
                }
                else if (argData.isFlagSet(DefaultTypeFlag[0]))
                {
                    uint   type   = (uint)impl.getDefaultType();
                    string result = getTypeStrings(type);
                    setResult(result);
                }
                else if (argData.isFlagSet(NumChannelsFlag[0]))
                {
                    uint result = impl.getNumChannels();
                    setResult(result);
                }
                else if (argData.isFlagSet(SemanticFlag[0]))
                {
                    string result = getSemanticString(impl.frameBufferSemantic());
                    setResult(result);
                }
                else if (argData.isFlagSet(PerLightFlag[0]))
                {
                    bool result = impl.perLightPassContributionSupported();
                    setResult(result);
                }
                else if (argData.isFlagSet(CompatFlag[0]))
                {
                    string fCompat = argData.flagArgumentString(CompatFlag[0], 0);
                    bool   result  = impl.isCompatible(fCompat);
                    setResult(result);
                }
                else
                {
                    // just indicate the implementation exists
                    setResult(true);
                }
            }
            else
            {
                // pass information
                if (argData.isFlagSet(NameFlag[0]))
                {
                    setResult(def.getName());
                }
                else if (argData.isFlagSet(GroupFlag[0]))
                {
                    setResult(def.getGroup());
                }
                else if (argData.isFlagSet(DescriptionFlag[0]))
                {
                    setResult(def.getDescription());
                }
                else
                {
                    // just indicate the definition exists
                    setResult(true);
                }
            }

            return;
        }
Example #2
0
		private string getSemanticString(MPxRenderPassImpl.PassSemantic sem)
		{
			string result = "unrecognizedValue";

			switch (sem)
			{
			case MPxRenderPassImpl.PassSemantic.kInvalidSemantic:
				result = "kInvalidSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kColorSemantic:
				result = "kColorSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kVectorSemantic:
				result = "kVectorSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kDirectionVectorSemantic:
				result = "kDirectionVectorSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kDepthSemantic:
				result = "kDepthSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kLabelSemantic:
				result = "kLabelSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kMaskSemantic:
				result = "kMaskSemantic";
				break;
			case MPxRenderPassImpl.PassSemantic.kOtherSemantic:
				result = "kOtherSemantic";
				break;
			}

			return result;
		}