Package org.sunflow

Class FileSunflowAPI

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int frame  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected FileSunflowAPI()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void camera​(java.lang.String name, java.lang.String lensType)
      Defines a camera with a given name.
      abstract void close()  
      void currentFrame​(int currentFrame)
      Set the value of the current frame.
      void geometry​(java.lang.String name, java.lang.String typeName)
      Defines a geometry with a given name.
      int getCurrentFrame()  
      boolean include​(java.lang.String filename)
      Parse the specified filename.
      void instance​(java.lang.String name, java.lang.String geoname)
      Instance the specified geometry into the scene.
      void light​(java.lang.String name, java.lang.String lightType)
      Defines a light source with a given name.
      void modifier​(java.lang.String name, java.lang.String modifierType)
      Defines a modifier with a given name.
      void options​(java.lang.String name)
      Defines an option object to hold the current parameters.
      void parameter​(java.lang.String name, boolean value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, float value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, int value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, int[] value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, java.lang.String value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, java.lang.String[] value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, java.lang.String colorspace, float... data)
      Declare a color parameter in the given colorspace using the specified name and value.
      void parameter​(java.lang.String name, java.lang.String type, java.lang.String interpolation, float[] data)
      Declare a parameter with the specified name.
      void parameter​(java.lang.String name, Matrix4 value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, Point2 value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, Point3 value)
      Declare a parameter with the specified name and value.
      void parameter​(java.lang.String name, Vector3 value)
      Declare a parameter with the specified name and value.
      void plugin​(java.lang.String type, java.lang.String name, java.lang.String code)
      Declare a plugin of the specified type with the given name from a java code string.
      void remove​(java.lang.String name)
      Remove the specified render object.
      void render​(java.lang.String optionsName, Display display)
      Render using the specified options and the specified display.
      void reset()
      Reset the state of the API completely.
      void searchpath​(java.lang.String type, java.lang.String path)
      Add the specified path to the list of directories which are searched automatically to resolve scene filenames or textures.
      void shader​(java.lang.String name, java.lang.String shaderType)
      Defines a shader with a given name.
      protected abstract void writeBoolean​(boolean value)  
      protected abstract void writeFloat​(float value)  
      protected abstract void writeInt​(int value)  
      protected abstract void writeInterpolationType​(ParameterList.InterpolationType interp)  
      protected abstract void writeKeyword​(SCAbstractParser.Keyword keyword)  
      protected abstract void writeMatrix​(Matrix4 value)  
      protected abstract void writeNewline​(int indentNext)  
      protected abstract void writeString​(java.lang.String string)  
      protected abstract void writeVerbatimString​(java.lang.String string)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • frame

        private int frame
    • Constructor Detail

      • FileSunflowAPI

        protected FileSunflowAPI()
    • Method Detail

      • camera

        public void camera​(java.lang.String name,
                           java.lang.String lensType)
        Description copied from interface: SunflowAPIInterface
        Defines a camera with a given name. The camera is built from the specified camera lens type plugin. If the lens type name is left null, the camera with the given name will be updated (if it exists). It is not currently possible to change the lens of a camera after it has been created.
        Specified by:
        camera in interface SunflowAPIInterface
        Parameters:
        name - camera name
        lensType - a camera lens plugin type name
      • geometry

        public void geometry​(java.lang.String name,
                             java.lang.String typeName)
        Description copied from interface: SunflowAPIInterface
        Defines a geometry with a given name. The geometry is built from the specified type. Note that geometries may be created from Tesselatable objects or PrimitiveList objects. This means that two seperate plugin lists will be searched for the geometry type. Tesselatable objects are search first. If the type name is left null, the geometry with the given name will be updated (if it exists).
        Specified by:
        geometry in interface SunflowAPIInterface
        Parameters:
        name - a unique name given to the geometry
        typeName - a tesselatable or primitive plugin type name
      • getCurrentFrame

        public int getCurrentFrame()
      • instance

        public void instance​(java.lang.String name,
                             java.lang.String geoname)
        Description copied from interface: SunflowAPIInterface
        Instance the specified geometry into the scene. If geoname is null, the specified instance object will be updated (if it exists). In order to change the instancing relationship of an existing instance, you should use the "geometry" string attribute.
        Specified by:
        instance in interface SunflowAPIInterface
        Parameters:
        name - instance name
        geoname - name of the geometry to instance
      • light

        public void light​(java.lang.String name,
                          java.lang.String lightType)
        Description copied from interface: SunflowAPIInterface
        Defines a light source with a given name. If the light type name is left null, the light source with the given name will be updated (if it exists).
        Specified by:
        light in interface SunflowAPIInterface
        Parameters:
        name - a unique name given to the light source
        lightType - a light source plugin type name
      • modifier

        public void modifier​(java.lang.String name,
                             java.lang.String modifierType)
        Description copied from interface: SunflowAPIInterface
        Defines a modifier with a given name. If the modifier type name is left null, the modifier with the given name will be updated (if it exists).
        Specified by:
        modifier in interface SunflowAPIInterface
        Parameters:
        name - a unique name given to the modifier
        modifierType - a modifier plugin type name
      • options

        public void options​(java.lang.String name)
        Description copied from interface: SunflowAPIInterface
        Defines an option object to hold the current parameters. If the object already exists, the values will simply override previous ones.
        Specified by:
        options in interface SunflowAPIInterface
      • parameter

        public void parameter​(java.lang.String name,
                              java.lang.String value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              boolean value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              int value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              float value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              java.lang.String colorspace,
                              float... data)
        Description copied from interface: SunflowAPIInterface
        Declare a color parameter in the given colorspace using the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        colorspace - color space or null to assume internal color space
        data - floating point color data
      • parameter

        public void parameter​(java.lang.String name,
                              Point3 value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              Vector3 value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              Point2 value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              Matrix4 value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              int[] value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              java.lang.String[] value)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name and value. This parameter will be added to the currently active parameter list.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        value - parameter value
      • parameter

        public void parameter​(java.lang.String name,
                              java.lang.String type,
                              java.lang.String interpolation,
                              float[] data)
        Description copied from interface: SunflowAPIInterface
        Declare a parameter with the specified name. The type may be one of the follow: "float", "point", "vector", "texcoord", "matrix". The interpolation determines how the parameter is to be interpreted over surface (see ParameterList.InterpolationType). The data is specified in a flattened float array.
        Specified by:
        parameter in interface SunflowAPIInterface
        Parameters:
        name - parameter name
        type - parameter data type
        interpolation - parameter interpolation mode
        data - raw floating point data
      • include

        public boolean include​(java.lang.String filename)
        Description copied from interface: SunflowAPIInterface
        Parse the specified filename. The include paths are searched first. The contents of the file are simply added to the active scene. This allows to break up a scene into parts, even across file formats. The appropriate parser is chosen based on file extension.
        Specified by:
        include in interface SunflowAPIInterface
        Parameters:
        filename - filename to load
        Returns:
        true upon sucess, false if an error occured.
      • plugin

        public void plugin​(java.lang.String type,
                           java.lang.String name,
                           java.lang.String code)
        Description copied from interface: SunflowAPIInterface
        Declare a plugin of the specified type with the given name from a java code string. The code will be compiled with Janino and registered as a new plugin type upon success.
        Specified by:
        plugin in interface SunflowAPIInterface
      • remove

        public void remove​(java.lang.String name)
        Description copied from interface: SunflowAPIInterface
        Remove the specified render object. Note that this may cause the removal of other objects which depended on it.
        Specified by:
        remove in interface SunflowAPIInterface
        Parameters:
        name - name of the object to remove
      • render

        public void render​(java.lang.String optionsName,
                           Display display)
        Description copied from interface: SunflowAPIInterface
        Render using the specified options and the specified display. If the specified options do not exist - defaults will be used.
        Specified by:
        render in interface SunflowAPIInterface
        Parameters:
        optionsName - name of the RenderObject which contains the options
        display - display object
      • reset

        public void reset()
        Description copied from interface: SunflowAPIInterface
        Reset the state of the API completely. The object table is cleared, and all search paths are set back to their default values.
        Specified by:
        reset in interface SunflowAPIInterface
      • searchpath

        public void searchpath​(java.lang.String type,
                               java.lang.String path)
        Description copied from interface: SunflowAPIInterface
        Add the specified path to the list of directories which are searched automatically to resolve scene filenames or textures. Currently the supported searchpath types are: "include" and "texture". All other types will be ignored.
        Specified by:
        searchpath in interface SunflowAPIInterface
      • currentFrame

        public void currentFrame​(int currentFrame)
        Description copied from interface: SunflowAPIInterface
        Set the value of the current frame. This value is intended only for procedural animation creation. It is not used by the Sunflow core in anyway. The default value is 1.
        Specified by:
        currentFrame in interface SunflowAPIInterface
        Parameters:
        currentFrame - current frame number
      • shader

        public void shader​(java.lang.String name,
                           java.lang.String shaderType)
        Description copied from interface: SunflowAPIInterface
        Defines a shader with a given name. If the shader type name is left null, the shader with the given name will be updated (if it exists).
        Specified by:
        shader in interface SunflowAPIInterface
        Parameters:
        name - a unique name given to the shader
        shaderType - a shader plugin type
      • writeBoolean

        protected abstract void writeBoolean​(boolean value)
      • writeInt

        protected abstract void writeInt​(int value)
      • writeFloat

        protected abstract void writeFloat​(float value)
      • writeString

        protected abstract void writeString​(java.lang.String string)
      • writeVerbatimString

        protected abstract void writeVerbatimString​(java.lang.String string)
      • writeMatrix

        protected abstract void writeMatrix​(Matrix4 value)
      • writeNewline

        protected abstract void writeNewline​(int indentNext)
      • close

        public abstract void close()