Example #1
0
            public ShadeArgs( OpsParsedStatement statement)
            {
                foreach(OpsParsedArgument arg in statement.Args)
                {
                    if(string.Compare(arg.Name, "Shader", true) == 0)
                    {
                        Shader = arg.Value;
                    }
                    else if(string.Compare(arg.Name, "filename", true) == 0)
                    {
                        File = arg.Value;
                    }
                    else if(string.Compare(arg.Name, "", true) == 0)
                    {
                        File = arg.Value;
                    }
                    else if(string.Compare(arg.Name, "Src", true) == 0)
                    {}//do nothing...this is just to make sure we don't make it a parameter for the psh
                    else
                    {
                        Constants.Add(arg);
                    }
                }

                if( File == null )
                    throw OpsException.ArgRequired("filename");

            }
Example #2
0
            public MipArgs( OpsParsedStatement statement)
            {
                OpsParsedArgument srcArg = statement.FindArgument("Start");
                if( srcArg != null )
                    Start = int.Parse( srcArg.Value );

                OpsParsedArgument filterArg = statement.FindArgument("Filter");
                if( filterArg != null )
                {
                    if(0==string.Compare(filterArg.Value, "None", true) )
                        Filter |= Filter.None;
                    else if(0==string.Compare(filterArg.Value, "Point", true) )
                        Filter |= Filter.Point;
                    else if(0==string.Compare(filterArg.Value, "Linear", true) )
                        Filter |= Filter.Linear;
                    else if(0==string.Compare(filterArg.Value, "Triangle", true) )
                        Filter |= Filter.Triangle;
                    else if(0==string.Compare(filterArg.Value, "Box", true) )
                        Filter |= Filter.Box;
                    else
                        throw new OpsException("Filter Argument is invalid");
                }
                else
                    Filter |= Filter.Box;


                OpsParsedArgument ditherArg = statement.FindArgument("Dither");
                if( ditherArg != null )
                {
                    if(0!=int.Parse(ditherArg.Value) )
                        Filter |= Filter.Dither;
                }
            }
Example #3
0
        public IOpsCommand RemapCommand(OpsParsedStatement statement)
        {
            OpsParsedArgument fileArg = statement.FindArgument("filename");

            if (fileArg == null)
            {
                fileArg = statement.FindArgument("");
                if (fileArg == null)
                {
                    throw OpsException.ArgRequired("filename");
                }
            }
            string filename = fileArg.Value;


            string extension = System.IO.Path.GetExtension(filename);

            if (extension == null || extension[0] == '\0')
            {
                throw new OpsException("Cannot find an appropriate loader for file: " + filename);
            }

            if (extension[0] == '.')
            {
                extension = extension.TrimStart(new char[] { '.' });
            }

            return(Program.CommandLibrary.GetCommand("Load" + extension));
        }
Example #4
0
            public AdjacencyArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument type = statement.FindArgument("type");

                if (type != null)
                {
                    if (0 == String.Compare(type.Value, "topological", true))
                    {
                        Topological = true;
                    }
                    else if (0 == String.Compare(type.Value, "geometric", true))
                    {
                        Topological = false;
                    }
                    else
                    {
                        throw new OpsException("Type argument does not match a valid type (topological|geometric)");
                    }
                }

                OpsParsedArgument epsilon = statement.FindArgument("epsilon");

                if (epsilon != null)
                {
                    Epsilon = float.Parse(epsilon.Value);
                }
            }
Example #5
0
            public SavexArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument fileArg = statement.FindArgument("filename");
                if(fileArg == null)
                {
                    fileArg = statement.FindArgument("");
                    if(fileArg == null)
                        throw OpsException.ArgRequired("filename");
                }
                Filename = fileArg.Value;
                if(!Path.IsPathRooted(Filename))
                {
                    Filename = Path.Combine(Directory.GetCurrentDirectory(), Filename);
                }

                OpsParsedArgument argX = statement.FindArgument("XFileType");
                if(argX != null)
                {
                    if( 0 == String.Compare( argX.Value, "text", true))
                        saveType = XFileFormat.Text;
                    else if( 0 == String.Compare( argX.Value, "binary", true))
                        saveType = XFileFormat.Binary;
                    else if( 0 == String.Compare( argX.Value, "compressed", true))
                        saveType = XFileFormat.Compressed;
                    else
                        throw new OpsException("Unrecognized XFile argument value.  Use (text|binary|compressed)");
                }

            }
Example #6
0
            public AddVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument typeArg = statement.FindArgument("type");

                if (typeArg == null)
                {
                    typeArg = statement.FindArgument("");
                    if (typeArg == null)
                    {
                        throw new OpsException("'type' argument argument");
                    }
                }
                type = MeshDeclarationHelper.DecodeType(typeArg.Value);

                OpsParsedArgument usageArg = statement.FindArgument("usage");

                if (usageArg != null)
                {
                    usage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);
                }

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");

                if (usageIdxArg != null)
                {
                    usageIdx = int.Parse(usageIdxArg.Value);
                }
            }
Example #7
0
            public ShadeArgs(OpsParsedStatement statement)
            {
                foreach (OpsParsedArgument arg in statement.Args)
                {
                    if (string.Compare(arg.Name, "Shader", true) == 0)
                    {
                        Shader = arg.Value;
                    }
                    else if (string.Compare(arg.Name, "filename", true) == 0)
                    {
                        File = arg.Value;
                    }
                    else if (string.Compare(arg.Name, "", true) == 0)
                    {
                        File = arg.Value;
                    }
                    else if (string.Compare(arg.Name, "Src", true) == 0)
                    {
                    } //do nothing...this is just to make sure we don't make it a parameter for the psh
                    else
                    {
                        Constants.Add(arg);
                    }
                }

                if (File == null)
                {
                    throw OpsException.ArgRequired("filename");
                }
            }
Example #8
0
            public StripifyArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument splits = statement.FindArgument("splits");

                if (splits != null && int.Parse(splits.Value) == 0)
                {
                    meshFlags |= MeshFlags.OptimizeDoNotSplit;
                }
            }
Example #9
0
            public NewTex2dArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument nameArg = statement.FindArgument("dst");

                if (nameArg == null)
                {
                    nameArg = statement.FindArgument("");
                    if (nameArg == null)
                    {
                        throw OpsException.ArgRequired("dst");
                    }
                }
                Name = nameArg.Value;

                OpsParsedArgument formatArg = statement.FindArgument("Format");

                if (formatArg == null)
                {
                    throw OpsException.ArgRequired("format");
                }
                this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;

                OpsParsedArgument widthArg = statement.FindArgument("Width");

                if (widthArg == null)
                {
                    throw OpsException.ArgRequired("width");
                }
                Width = int.Parse(widthArg.Value);

                OpsParsedArgument heightArg = statement.FindArgument("Height");

                if (heightArg == null)
                {
                    throw OpsException.ArgRequired("height");
                }
                Height = int.Parse(heightArg.Value);

                if (Width > 4096 || Height > 4096)
                {
                    throw new OpsException("Dimensions must not exceed 4k");
                }


                OpsParsedArgument mipsArg = statement.FindArgument("Mips");

                if (mipsArg != null)
                {
                    Mips = int.Parse(mipsArg.Value);
                }

                OpsParsedArgument srcArg = statement.FindArgument("Src");

                Src = (srcArg == null) ? null : srcArg.Value;
            }
 public TexFormatArgs( OpsParsedStatement statement)
 {
     OpsParsedArgument formatArg = statement.FindArgument("format");
     if( formatArg == null )
     {
         formatArg = statement.FindArgument("");
         if( formatArg == null )
             throw OpsException.ArgRequired("format");
     }
     this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;
 }
Example #11
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     OpsParsedArgument pathArg = statement.FindArgument("filename");
     if(pathArg == null)
     {
         pathArg = statement.FindArgument("");
         if(pathArg == null)
             throw OpsException.ArgRequired("filename");
     }
     return pathArg.Value;
 }
Example #12
0
            public MipArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument srcArg = statement.FindArgument("Start");

                if (srcArg != null)
                {
                    Start = int.Parse(srcArg.Value);
                }

                OpsParsedArgument filterArg = statement.FindArgument("Filter");

                if (filterArg != null)
                {
                    if (0 == string.Compare(filterArg.Value, "None", true))
                    {
                        Filter |= Filter.None;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Point", true))
                    {
                        Filter |= Filter.Point;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Linear", true))
                    {
                        Filter |= Filter.Linear;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Triangle", true))
                    {
                        Filter |= Filter.Triangle;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Box", true))
                    {
                        Filter |= Filter.Box;
                    }
                    else
                    {
                        throw new OpsException("Filter Argument is invalid");
                    }
                }
                else
                {
                    Filter |= Filter.Box;
                }


                OpsParsedArgument ditherArg = statement.FindArgument("Dither");

                if (ditherArg != null)
                {
                    if (0 != int.Parse(ditherArg.Value))
                    {
                        Filter |= Filter.Dither;
                    }
                }
            }
Example #13
0
            public FlattenArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument newModelArg = statement.FindArgument("dst");
                if(newModelArg == null)
                {
                    newModelArg = statement.FindArgument("");
                    if(newModelArg == null)
                        throw OpsException.ArgRequired("dst");
                }

                NewModel = newModelArg.Value;
            }
            public TexFormatArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument formatArg = statement.FindArgument("format");

                if (formatArg == null)
                {
                    formatArg = statement.FindArgument("");
                    if (formatArg == null)
                    {
                        throw OpsException.ArgRequired("format");
                    }
                }
                this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;
            }
Example #15
0
            public FlattenArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument newModelArg = statement.FindArgument("dst");

                if (newModelArg == null)
                {
                    newModelArg = statement.FindArgument("");
                    if (newModelArg == null)
                    {
                        throw OpsException.ArgRequired("dst");
                    }
                }

                NewModel = newModelArg.Value;
            }
            public NewTexCubeArgs( OpsParsedStatement statement)
            {
                OpsParsedArgument nameArg = statement.FindArgument("dst");
                if( nameArg == null )
                {
                    nameArg = statement.FindArgument("");
                    if( nameArg == null )
                        throw OpsException.ArgRequired("dst");
                }
                Name = nameArg.Value;

                OpsParsedArgument formatArg = statement.FindArgument("Format");
                if( formatArg == null )
                    throw OpsException.ArgRequired("format");
                this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;

                OpsParsedArgument sizeArg = statement.FindArgument("Size");
                if( sizeArg == null )
                    throw OpsException.ArgRequired("size");
                Size = int.Parse( sizeArg.Value );

                if(Size > 4096)
                    throw new OpsException("Dimensions must not exceed 4k");

                OpsParsedArgument mipsArg = statement.FindArgument("Mips");
                if( mipsArg != null )
                    Mips = int.Parse( mipsArg.Value );

                OpsParsedArgument srcxpArg = statement.FindArgument("SrcXP");
                SrcXP = ( srcxpArg == null ) ? null : srcxpArg.Value;

                OpsParsedArgument srcxmArg = statement.FindArgument("SrcXM");
                SrcXM = ( srcxmArg == null ) ? null : srcxmArg.Value;

                OpsParsedArgument srcypArg = statement.FindArgument("SrcYP");
                SrcYP = ( srcypArg == null ) ? null : srcypArg.Value;

                OpsParsedArgument srcymArg = statement.FindArgument("SrcYM");
                SrcYM = ( srcymArg == null ) ? null : srcymArg.Value;

                OpsParsedArgument srczpArg = statement.FindArgument("SrcZP");
                SrcZP = ( srcypArg == null ) ? null : srczpArg.Value;

                OpsParsedArgument srczmArg = statement.FindArgument("SrcZM");
                SrcZM = ( srczmArg == null ) ? null : srczmArg.Value;
            }
Example #17
0
            public AdjacencyArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument type = statement.FindArgument("type");
                if(type != null)
                {
                    if(0==String.Compare( type.Value,"topological" , true))
                        Topological = true;
                    else if(0==String.Compare( type.Value,"geometric" , true))
                        Topological = false;
                    else
                        throw new OpsException("Type argument does not match a valid type (topological|geometric)");
                }

                OpsParsedArgument epsilon = statement.FindArgument("epsilon");
                if(epsilon!=null)
                    Epsilon= float.Parse(epsilon.Value);
            }
Example #18
0
            public UnloadArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument srcArg = statement.FindArgument("src");

                if (srcArg == null)
                {
                    srcArg = statement.FindArgument("");
                    if (srcArg == null)
                    {
                        throw OpsException.ArgRequired("src");
                    }
                }
                Src = srcArg.Value;

                OpsParsedArgument filterArg = statement.FindArgument("Type");

                if (filterArg != null)
                {
                    if (0 == string.Compare(filterArg.Value, "Texture", true))
                    {
                        Type = ContentType.TEXTURES;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Textures", true))
                    {
                        Type = ContentType.TEXTURES;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Model", true))
                    {
                        Type = ContentType.MODELS;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Models", true))
                    {
                        Type = ContentType.MODELS;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Both", true))
                    {
                        Type = ContentType.GENERIC;
                    }
                    else
                    {
                        throw new OpsException("Type Argument is invalid.  Value must be (Textures|Models|Both).");
                    }
                }
            }
Example #19
0
            public OpsUVAtlasArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument argTexIdx = statement.FindArgument("TexIdx");

                if (argTexIdx != null)
                {
                    TexIdx = int.Parse(argTexIdx.Value);
                }

                OpsParsedArgument argMaxcharts = statement.FindArgument("MaxCharts");

                if (argMaxcharts != null)
                {
                    MaxCharts = int.Parse(argMaxcharts.Value);
                }

                OpsParsedArgument argStretch = statement.FindArgument("Stretch");

                if (argStretch != null)
                {
                    Stretch = float.Parse(argStretch.Value);
                }

                OpsParsedArgument argGutter = statement.FindArgument("Gutter");

                if (argGutter != null)
                {
                    Gutter = int.Parse(argGutter.Value);
                }

                OpsParsedArgument argWidth = statement.FindArgument("Height");

                if (argWidth != null)
                {
                    Width = int.Parse(argWidth.Value);
                }

                OpsParsedArgument argHeight = statement.FindArgument("Height");

                if (argHeight != null)
                {
                    Height = int.Parse(argHeight.Value);
                }
            }
            public TexResizeArgs( OpsParsedStatement statement)
            {
                OpsParsedArgument widthArg = statement.FindArgument("Width");
                if( widthArg != null )
                    Width = int.Parse( widthArg.Value );

                OpsParsedArgument heightArg = statement.FindArgument("Height");
                if( heightArg != null )
                    Height = int.Parse( heightArg.Value );

                OpsParsedArgument depthArg = statement.FindArgument("Depth");
                if( depthArg != null )
                    Depth = int.Parse( depthArg.Value );



                OpsParsedArgument filterArg = statement.FindArgument("Filter");
                if( filterArg != null )
                {
                    if(0==string.Compare(filterArg.Value, "None", true) )
                        Filter |= Filter.None;
                    else if(0==string.Compare(filterArg.Value, "Point", true) )
                        Filter |= Filter.Point;
                    else if(0==string.Compare(filterArg.Value, "Linear", true) )
                        Filter |= Filter.Linear;
                    else if(0==string.Compare(filterArg.Value, "Triangle", true) )
                        Filter |= Filter.Triangle;
                    else if(0==string.Compare(filterArg.Value, "Box", true) )
                        Filter |= Filter.Box;
                    else
                        throw new OpsException("Filter Argument is invalid");
                }
                else
                    Filter |= Filter.Box;


                OpsParsedArgument ditherArg = statement.FindArgument("Dither");
                if( ditherArg != null )
                {
                    if(0!=int.Parse(ditherArg.Value) )
                        Filter |= Filter.Dither;
                }
            }
Example #21
0
            public NewTex3dArgs( OpsParsedStatement statement)
            {
                OpsParsedArgument nameArg = statement.FindArgument("dst");
                if( nameArg == null )
                {
                    nameArg = statement.FindArgument("");
                    if( nameArg == null )
                        throw OpsException.ArgRequired("dst");
                }
                Name = nameArg.Value;

                OpsParsedArgument formatArg = statement.FindArgument("Format");
                if( formatArg == null )
                    throw OpsException.ArgRequired("format");
                this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;

                OpsParsedArgument widthArg = statement.FindArgument("Width");
                if( widthArg == null )
                    throw OpsException.ArgRequired("width");
                Width = int.Parse( widthArg.Value );

                OpsParsedArgument heightArg = statement.FindArgument("Height");
                if( heightArg == null )
                    throw OpsException.ArgRequired("height");
                Height = int.Parse( heightArg.Value );

                OpsParsedArgument depthArg = statement.FindArgument("Depth");
                if( depthArg == null )
                    throw OpsException.ArgRequired("depth");
                Depth = int.Parse( depthArg.Value );

                if(Width > 4096 || Height > 4096 || Depth > 4096)
                    throw new OpsException("Dimensions must not exceed 4k");

                OpsParsedArgument mipsArg = statement.FindArgument("Mips");
                if( mipsArg != null )
                    Mips = int.Parse( mipsArg.Value );

                OpsParsedArgument srcArg = statement.FindArgument("Src");
                Src = ( srcArg == null ) ? null : srcArg.Value;

            }
            public TexSaverArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument fileArg = statement.FindArgument("filename");

                if (fileArg == null)
                {
                    fileArg = statement.FindArgument("");
                    if (fileArg == null)
                    {
                        throw OpsException.ArgRequired("filename");
                    }
                }
                this.Path = fileArg.Value;

                string extension = System.IO.Path.GetExtension(Path);

                extension = extension.TrimStart(new char[] { '.' });

                this.Format = (ImageFileFormat)Enum.Parse(typeof(ImageFileFormat), extension, true);
            }
            public AddVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument typeArg = statement.FindArgument("type");
                if(typeArg == null)
                {
                    typeArg = statement.FindArgument("");
                    if(typeArg == null)
                        throw new OpsException("'type' argument argument");
                }
                type = MeshDeclarationHelper.DecodeType(typeArg.Value);

                OpsParsedArgument usageArg = statement.FindArgument("usage");
                if(usageArg != null)
                    usage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");
                if(usageIdxArg != null)
                    usageIdx = int.Parse( usageIdxArg.Value );

            }
Example #24
0
        public IOpsCommand RemapCommand(OpsParsedStatement statement)
        { 
            OpsParsedArgument fileArg = statement.FindArgument("filename");
            if(fileArg == null)
            {
                fileArg = statement.FindArgument("");
                if(fileArg == null)
                    throw OpsException.ArgRequired("filename");
            }
            string filename = fileArg.Value;

            string extension = System.IO.Path.GetExtension(filename);

            if(extension == null || extension[0] == '\0')
                throw new OpsException("Cannot find an appropriate loader for file: " + filename);

            if(extension[0] == '.')
                extension = extension.TrimStart( new char[]{ '.' });

            return Program.CommandLibrary.GetCommand( "Save" + extension );
        }
Example #25
0
            public SavexArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument fileArg = statement.FindArgument("filename");

                if (fileArg == null)
                {
                    fileArg = statement.FindArgument("");
                    if (fileArg == null)
                    {
                        throw OpsException.ArgRequired("filename");
                    }
                }
                Filename = fileArg.Value;
                if (!Path.IsPathRooted(Filename))
                {
                    Filename = Path.Combine(Directory.GetCurrentDirectory(), Filename);
                }

                OpsParsedArgument argX = statement.FindArgument("XFileType");

                if (argX != null)
                {
                    if (0 == String.Compare(argX.Value, "text", true))
                    {
                        saveType = XFileFormat.Text;
                    }
                    else if (0 == String.Compare(argX.Value, "binary", true))
                    {
                        saveType = XFileFormat.Binary;
                    }
                    else if (0 == String.Compare(argX.Value, "compressed", true))
                    {
                        saveType = XFileFormat.Compressed;
                    }
                    else
                    {
                        throw new OpsException("Unrecognized XFile argument value.  Use (text|binary|compressed)");
                    }
                }
            }
Example #26
0
            public Slice2dArgs( OpsParsedStatement statement)
            {
                OpsParsedArgument nameArg = statement.FindArgument("dst");
                if( nameArg == null )
                {
                    nameArg = statement.FindArgument("");
                    if( nameArg == null )
                        throw OpsException.ArgRequired("dst");
                }
                Dst = nameArg.Value;


                OpsParsedArgument volumeArg = statement.FindArgument("Volume");
                if( volumeArg != null )
                    Volume = int.Parse( volumeArg.Value );

                OpsParsedArgument faceArg = statement.FindArgument("Face");
                if( faceArg != null )
                {
                    if(0==string.Compare( faceArg.Value, "+x", true)) 
                        Face = CubeMapFace.PositiveX;
                    else if(0==string.Compare( faceArg.Value, "+y", true)) 
                        Face = CubeMapFace.PositiveY;
                    else if(0==string.Compare( faceArg.Value, "+z", true)) 
                        Face = CubeMapFace.PositiveZ;
                    else if(0==string.Compare( faceArg.Value, "-x", true)) 
                        Face = CubeMapFace.NegativeX;
                    else if(0==string.Compare( faceArg.Value, "-y", true)) 
                        Face = CubeMapFace.NegativeY;
                    else if(0==string.Compare( faceArg.Value, "-z", true)) 
                        Face = CubeMapFace.NegativeZ;
                    else
                        throw new OpsException("Face Argument was not recognized.  must be '[+-][xyz]'");
                }

                OpsParsedArgument mipsArg = statement.FindArgument("mipmap");
                if( mipsArg != null )
                    Mips = int.Parse( mipsArg.Value );
            }
            public TexLoaderArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument pathArg = statement.FindArgument("filename");

                if (pathArg == null)
                {
                    pathArg = statement.FindArgument("");
                    if (pathArg == null)
                    {
                        throw OpsException.ArgRequired("filename");
                    }
                }
                Path = pathArg.Value;


                OpsParsedArgument srgbArg = statement.FindArgument("srgb");

                if (srgbArg != null)
                {
                    SRGB = bool.Parse(srgbArg.Value);
                }
            }
Example #28
0
            public DelVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument usageArg = statement.FindArgument("usage");

                if (usageArg == null)
                {
                    usageArg = statement.FindArgument("");
                    if (usageArg == null)
                    {
                        throw OpsException.ArgRequired("usage");
                    }
                }
                usage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");

                if (usageIdxArg != null)
                {
                    hasSrcUsageIdx = true;
                    usageIdx       = int.Parse(usageIdxArg.Value);
                }
            }
Example #29
0
            public CloneVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument usageArg = statement.FindArgument("usage");

                if (usageArg == null)
                {
                    usageArg = statement.FindArgument("");
                    if (usageArg == null)
                    {
                        throw OpsException.ArgRequired("usage");
                    }
                }
                srcUsage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");

                if (usageIdxArg != null)
                {
                    srcUsageIdx    = int.Parse(usageIdxArg.Value);
                    hasSrcUsageIdx = true;
                }

                OpsParsedArgument dstUsageArg = statement.FindArgument("newusage");

                if (dstUsageArg != null)
                {
                    dstUsage = MeshDeclarationHelper.DecodeUsage(dstUsageArg.Value);
                }

                OpsParsedArgument dstUsageIdxArg = statement.FindArgument("newusageIdx");

                if (dstUsageIdxArg != null)
                {
                    dstUsageIdx    = int.Parse(dstUsageIdxArg.Value);
                    hasDstUsageIdx = true;
                }
            }
 public object ParseArguments(OpsParsedStatement statement)
 {
     return  new NewTexCubeArgs(statement);
 }
            public TexSaverArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument fileArg = statement.FindArgument("filename");
                if(fileArg == null)
                {
                    fileArg = statement.FindArgument("");
                    if(fileArg == null)
                        throw OpsException.ArgRequired("filename");
                }
                this.Path = fileArg.Value;

                string extension = System.IO.Path.GetExtension(Path);
                extension = extension.TrimStart( new char[]{'.'} );

                this.Format = (ImageFileFormat)Enum.Parse(typeof(ImageFileFormat), extension, true);

            }
Example #32
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new TangentArguments(statement);
 }
Example #33
0
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new Splice2dArgs(statement));
 }
Example #34
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new FlattenArguments(statement);
 }
Example #35
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(null);
 }
Example #36
0
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new TexResizeArgs(statement));
 }
Example #37
0
            public NewTexCubeArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument nameArg = statement.FindArgument("dst");

                if (nameArg == null)
                {
                    nameArg = statement.FindArgument("");
                    if (nameArg == null)
                    {
                        throw OpsException.ArgRequired("dst");
                    }
                }
                Name = nameArg.Value;

                OpsParsedArgument formatArg = statement.FindArgument("Format");

                if (formatArg == null)
                {
                    throw OpsException.ArgRequired("format");
                }
                this.Format = OpsFormatHelper.FindByFormat(formatArg.Value).Format;

                OpsParsedArgument sizeArg = statement.FindArgument("Size");

                if (sizeArg == null)
                {
                    throw OpsException.ArgRequired("size");
                }
                Size = int.Parse(sizeArg.Value);

                if (Size > 4096)
                {
                    throw new OpsException("Dimensions must not exceed 4k");
                }

                OpsParsedArgument mipsArg = statement.FindArgument("Mips");

                if (mipsArg != null)
                {
                    Mips = int.Parse(mipsArg.Value);
                }

                OpsParsedArgument srcxpArg = statement.FindArgument("SrcXP");

                SrcXP = (srcxpArg == null) ? null : srcxpArg.Value;

                OpsParsedArgument srcxmArg = statement.FindArgument("SrcXM");

                SrcXM = (srcxmArg == null) ? null : srcxmArg.Value;

                OpsParsedArgument srcypArg = statement.FindArgument("SrcYP");

                SrcYP = (srcypArg == null) ? null : srcypArg.Value;

                OpsParsedArgument srcymArg = statement.FindArgument("SrcYM");

                SrcYM = (srcymArg == null) ? null : srcymArg.Value;

                OpsParsedArgument srczpArg = statement.FindArgument("SrcZP");

                SrcZP = (srcypArg == null) ? null : srczpArg.Value;

                OpsParsedArgument srczmArg = statement.FindArgument("SrcZM");

                SrcZM = (srczmArg == null) ? null : srczmArg.Value;
            }
            public DelVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument usageArg = statement.FindArgument("usage");    
                if(usageArg == null)
                {
                    usageArg = statement.FindArgument("");    
                    if(usageArg == null)
                        throw OpsException.ArgRequired("usage");
                }
                usage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");
                if(usageIdxArg != null)
                {
                    hasSrcUsageIdx = true;
                    usageIdx = int.Parse( usageIdxArg.Value );
                }

            }
Example #39
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new FlattenArguments(statement));
 }
Example #40
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new AdjacencyArguments(statement);
 }
Example #41
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new SavexArguments(statement);
 }
Example #42
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new StripifyArguments(statement);
 }
Example #43
0
 public StripifyArguments(OpsParsedStatement statement)
 {
     OpsParsedArgument splits = statement.FindArgument("splits");
     if( splits != null && int.Parse(splits.Value) == 0)
         meshFlags |= MeshFlags.OptimizeDoNotSplit;
 }
Example #44
0
            public TangentArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument argTexIdx= statement.FindArgument( "TexIdx");
                if(argTexIdx != null)
                    TexIdx = int.Parse(argTexIdx.Value);

                OpsParsedArgument argOrtho= statement.FindArgument( "Ortho");
                if(argOrtho != null)
                {
                    if( 0 == String.Compare ( argOrtho.Value, "None", true ) )
                        Options |= TangentOptions.DontOrthogonalize;
                    else if( 0 == String.Compare ( argOrtho.Value, "U", true ) )
                        Options |= TangentOptions.OrthogonalizeFromU;
                    else if( 0 == String.Compare ( argOrtho.Value, "V", true ) )
                        Options |= TangentOptions.OrthogonalizeFromV;
                }

                OpsParsedArgument argNormalizePartials= statement.FindArgument( "NormalizePartials");
                if(argNormalizePartials != null)
                {
                    if ( 0 == int.Parse(argNormalizePartials.Value) )
                        Options |= TangentOptions.DontNormalizePartials;
                }

                OpsParsedArgument argWeight= statement.FindArgument( "Weight");
                if(argWeight != null)
                {
                    if( 0 == String.Compare ( argWeight.Value, "Area", true ) )
                        Options |= TangentOptions.WeightByArea;
                    else if( 0 == String.Compare ( argWeight.Value, "Equal", true ) )
                        Options |= TangentOptions.WeightEqual;
                }

                OpsParsedArgument argWarp= statement.FindArgument( "Wrap");
                if(argWarp != null)
                {
                    if( 0 == String.Compare ( argWarp.Value, "U", true ) )
                        Options |= TangentOptions.WrapU;
                    else if( 0 == String.Compare ( argWarp.Value, "V", true ) )
                        Options |= TangentOptions.WrapV;
                    else if( 0 == String.Compare ( argWarp.Value, "UV", true ) )
                        Options |= TangentOptions.WrapUV;
                }

                OpsParsedArgument argThreshPE= statement.FindArgument( "ThreshPE");
                if(argThreshPE != null)
                    ThreshPE = float.Parse(argThreshPE.Value);

                OpsParsedArgument argThreshSP= statement.FindArgument( "ThreshSP");
                if(argThreshSP != null)
                    ThreshSP = float.Parse(argThreshSP.Value);

                OpsParsedArgument argThreshNE= statement.FindArgument( "ThreshNE");
                if(argThreshNE != null)
                    ThreshNE = float.Parse(argThreshNE.Value);

            }
Example #45
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     throw new OpsException("This command must be remapped or implemented.");
 }
Example #46
0
 public object ParseArguments(OpsParsedStatement statement)
 {
     return  new Splice2dArgs(statement);
 }
Example #47
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new AddVDataArguments(statement));
 }
Example #48
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return null;
 }
Example #49
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new OptimizeArguments(statement));
 }
Example #50
0
            public TexResizeArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument widthArg = statement.FindArgument("Width");

                if (widthArg != null)
                {
                    Width = int.Parse(widthArg.Value);
                }

                OpsParsedArgument heightArg = statement.FindArgument("Height");

                if (heightArg != null)
                {
                    Height = int.Parse(heightArg.Value);
                }

                OpsParsedArgument depthArg = statement.FindArgument("Depth");

                if (depthArg != null)
                {
                    Depth = int.Parse(depthArg.Value);
                }



                OpsParsedArgument filterArg = statement.FindArgument("Filter");

                if (filterArg != null)
                {
                    if (0 == string.Compare(filterArg.Value, "None", true))
                    {
                        Filter |= Filter.None;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Point", true))
                    {
                        Filter |= Filter.Point;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Linear", true))
                    {
                        Filter |= Filter.Linear;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Triangle", true))
                    {
                        Filter |= Filter.Triangle;
                    }
                    else if (0 == string.Compare(filterArg.Value, "Box", true))
                    {
                        Filter |= Filter.Box;
                    }
                    else
                    {
                        throw new OpsException("Filter Argument is invalid");
                    }
                }
                else
                {
                    Filter |= Filter.Box;
                }


                OpsParsedArgument ditherArg = statement.FindArgument("Dither");

                if (ditherArg != null)
                {
                    if (0 != int.Parse(ditherArg.Value))
                    {
                        Filter |= Filter.Dither;
                    }
                }
            }
Example #51
0
            public OptimizeArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument splits  = statement.FindArgument("splits");
                OpsParsedArgument nocache = statement.FindArgument("nocache");
                OpsParsedArgument weld    = statement.FindArgument("weld");
                OpsParsedArgument e       = statement.FindArgument("e");
                OpsParsedArgument P       = statement.FindArgument("P");
                OpsParsedArgument W       = statement.FindArgument("W");
                OpsParsedArgument N       = statement.FindArgument("N");
                OpsParsedArgument T       = statement.FindArgument("T");
                OpsParsedArgument B       = statement.FindArgument("B");
                OpsParsedArgument UV      = statement.FindArgument("UV");
                OpsParsedArgument D       = statement.FindArgument("D");
                OpsParsedArgument S       = statement.FindArgument("S");
                OpsParsedArgument PS      = statement.FindArgument("PS");
                OpsParsedArgument F       = statement.FindArgument("F");


                if (splits != null && int.Parse(splits.Value) == 0)
                {
                    meshFlags |= MeshFlags.OptimizeDoNotSplit;
                }

                if (nocache != null && int.Parse(nocache.Value) == 0)
                {
                    meshFlags |= MeshFlags.OptimizeVertexCache;
                }

                if (weld != null)
                {
                    if (0 == String.Compare(weld.Value, "none", true))
                    {
                        weldType = WeldType.None;
                    }
                    else if (0 == String.Compare(weld.Value, "all", true))
                    {
                        weldType      = WeldType.All;
                        epsilonFlags |= WeldEpsilonsFlags.WeldAll;
                    }
                }


                if (weldType == WeldType.Epsilon)
                {
                    float delta = 1.0e-6f;

                    if (e != null)
                    {
                        delta = float.Parse(e.Value);
                    }

                    epsilons.Binormal         = delta;
                    epsilons.BlendWeights     = delta;
                    epsilons.Diffuse          = delta;
                    epsilons.Normal           = delta;
                    epsilons.PointSize        = delta;
                    epsilons.Position         = delta;
                    epsilons.Specular         = delta;
                    epsilons.Tangent          = delta;
                    epsilons.TessellateFactor = delta;

                    if (P != null)
                    {
                        epsilons.Position = float.Parse(P.Value);
                    }

                    if (W != null)
                    {
                        epsilons.BlendWeights = float.Parse(W.Value);
                    }

                    if (N != null)
                    {
                        epsilons.Normal = float.Parse(N.Value);
                    }

                    if (T != null)
                    {
                        epsilons.Tangent = float.Parse(T.Value);
                    }

                    if (B != null)
                    {
                        epsilons.Binormal = float.Parse(B.Value);
                    }

                    float   uvDelta      = (UV == null) ? delta : float.Parse(UV.Value);
                    float[] uvDeltaArray = epsilons.TextureCoordinate;
                    for (int i = 0; i < uvDeltaArray.Length; i++)
                    {
                        uvDeltaArray[i] = uvDelta;
                    }
                    epsilons.TextureCoordinate = uvDeltaArray;

                    if (D != null)
                    {
                        epsilons.Diffuse = float.Parse(D.Value);
                    }

                    if (S != null)
                    {
                        epsilons.Specular = float.Parse(S.Value);
                    }

                    if (PS != null)
                    {
                        epsilons.PointSize = float.Parse(PS.Value);
                    }

                    if (F != null)
                    {
                        epsilons.TessellateFactor = float.Parse(F.Value);
                    }
                }
            }
Example #52
0
            public Splice2dArgs(OpsParsedStatement statement)
            {
                OpsParsedArgument dstArg = statement.FindArgument("dst");

                if (dstArg == null)
                {
                    dstArg = statement.FindArgument("");
                    if (dstArg == null)
                    {
                        throw OpsException.ArgRequired("dst");
                    }
                }
                Dst = dstArg.Value;

                OpsParsedArgument volumeArg = statement.FindArgument("Volume");

                if (volumeArg != null)
                {
                    Volume = int.Parse(volumeArg.Value);
                }

                OpsParsedArgument faceArg = statement.FindArgument("Face");

                if (faceArg != null)
                {
                    if (0 == string.Compare(faceArg.Value, "+x", true))
                    {
                        Face = CubeMapFace.PositiveX;
                    }
                    else if (0 == string.Compare(faceArg.Value, "+y", true))
                    {
                        Face = CubeMapFace.PositiveY;
                    }
                    else if (0 == string.Compare(faceArg.Value, "+z", true))
                    {
                        Face = CubeMapFace.PositiveZ;
                    }
                    else if (0 == string.Compare(faceArg.Value, "-x", true))
                    {
                        Face = CubeMapFace.NegativeX;
                    }
                    else if (0 == string.Compare(faceArg.Value, "-y", true))
                    {
                        Face = CubeMapFace.NegativeY;
                    }
                    else if (0 == string.Compare(faceArg.Value, "-z", true))
                    {
                        Face = CubeMapFace.NegativeZ;
                    }
                    else
                    {
                        throw new OpsException("Face Argument was not recognized.  must be '[+-][xyz]'");
                    }
                }

                OpsParsedArgument mipsArg = statement.FindArgument("mipmap");

                if (mipsArg != null)
                {
                    Mips = int.Parse(mipsArg.Value);
                }
            }
Example #53
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new UnloadArguments(statement));
 }
            public CloneVDataArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument usageArg = statement.FindArgument("usage");    
                if(usageArg == null)
                {
                    usageArg = statement.FindArgument("");    
                    if(usageArg == null)
                        throw OpsException.ArgRequired("usage");
                }
                srcUsage = MeshDeclarationHelper.DecodeUsage(usageArg.Value);

                OpsParsedArgument usageIdxArg = statement.FindArgument("usageIdx");
                if( usageIdxArg != null )
                {
                    srcUsageIdx = int.Parse( usageIdxArg.Value );
                    hasSrcUsageIdx = true;
                }

                OpsParsedArgument dstUsageArg = statement.FindArgument("newusage");
                if(dstUsageArg != null)
                    dstUsage = MeshDeclarationHelper.DecodeUsage(dstUsageArg.Value);

                OpsParsedArgument dstUsageIdxArg = statement.FindArgument("newusageIdx");
                if( dstUsageIdxArg != null )
                {
                    dstUsageIdx = int.Parse( dstUsageIdxArg.Value );
                    hasDstUsageIdx = true;
                }
            }
Example #55
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return(new AdjacencyArguments(statement));
 }
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new AddVDataArguments(statement);
 }
Example #57
0
 //IOpsCommand
 public object ParseArguments(OpsParsedStatement statement)
 {
     return new OptimizeArguments(statement);
 }
 public object ParseArguments(OpsParsedStatement statement)
 {
     return  new TexFormatArgs(statement);
 }
Example #59
0
            public OptimizeArguments(OpsParsedStatement statement)
            {
                OpsParsedArgument splits = statement.FindArgument("splits");
                OpsParsedArgument nocache = statement.FindArgument("nocache");
                OpsParsedArgument weld = statement.FindArgument("weld");
                OpsParsedArgument e = statement.FindArgument("e");
                OpsParsedArgument P = statement.FindArgument("P");
                OpsParsedArgument W = statement.FindArgument("W");
                OpsParsedArgument N = statement.FindArgument("N");
                OpsParsedArgument T = statement.FindArgument("T");
                OpsParsedArgument B = statement.FindArgument("B");
                OpsParsedArgument UV = statement.FindArgument("UV");
                OpsParsedArgument D = statement.FindArgument("D");
                OpsParsedArgument S = statement.FindArgument("S");
                OpsParsedArgument PS = statement.FindArgument("PS");
                OpsParsedArgument F = statement.FindArgument("F");


                if( splits != null && int.Parse(splits.Value) == 0)
                    meshFlags |= MeshFlags.OptimizeDoNotSplit;

                if( nocache != null && int.Parse(nocache.Value) == 0)
                    meshFlags |= MeshFlags.OptimizeVertexCache;

                if( weld != null)
                {
                    if( 0 == String.Compare( weld.Value, "none", true) )
                    {
                        weldType = WeldType.None;
                    }
                    else if( 0 == String.Compare( weld.Value, "all", true) )
                    {
                        weldType = WeldType.All;
                        epsilonFlags |= WeldEpsilonsFlags.WeldAll;
                    }
                }


                if(weldType == WeldType.Epsilon)
                {
                    float delta = 1.0e-6f;

                    if(e != null)
                        delta = float.Parse( e.Value );

                    epsilons.Binormal=delta;
                    epsilons.BlendWeights=delta;
                    epsilons.Diffuse=delta;
                    epsilons.Normal=delta;
                    epsilons.PointSize=delta;
                    epsilons.Position=delta;
                    epsilons.Specular=delta;
                    epsilons.Tangent=delta;
                    epsilons.TessellateFactor=delta;

                    if(P != null)
                        epsilons.Position = float.Parse( P.Value );

                    if(W != null)
                        epsilons.BlendWeights = float.Parse( W.Value );

                    if(N != null)
                        epsilons.Normal = float.Parse( N.Value );

                    if(T != null)
                        epsilons.Tangent = float.Parse( T.Value );

                    if(B != null)
                        epsilons.Binormal = float.Parse( B.Value );

                    float uvDelta = (UV == null) ? delta : float.Parse( UV.Value );
                    float[] uvDeltaArray = epsilons.TextureCoordinate;
                    for( int i = 0; i < uvDeltaArray.Length; i++)
                        uvDeltaArray[i] = uvDelta;
                    epsilons.TextureCoordinate = uvDeltaArray;

                    if(D != null)
                        epsilons.Diffuse = float.Parse( D.Value );

                    if(S != null)
                        epsilons.Specular = float.Parse( S.Value );

                    if(PS != null)
                        epsilons.PointSize = float.Parse( PS.Value );

                    if(F != null)
                        epsilons.TessellateFactor = float.Parse( F.Value );
                }

            
            }