Пример #1
0
        public DrawMeshCommand(Camera cam, GameObject gameObject, Exporter exporter)
        {
            ObjectType = CommandTypeDrawMesh;
            //-------------------------------------------------

            var meshfilter = gameObject.GetComponent <MeshFilter>();
            var mesh       = meshfilter.sharedMesh;

            _meshObject = exporter.GetObject(mesh) as MeshObject;
            // //------------------
        }
Пример #2
0
        //----------------------------------------
        public DataObjectBase GetObject(Object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            if (objects.ContainsKey(obj))
            {
                return(objects[obj]);
            }


            if (obj is Shader)
            {
                var dataobject = new ShaderObject(obj as Shader);
                objects[obj] = dataobject;
                return(dataobject);
            }

            if (obj is Mesh)
            {
                var dataobject = new MeshObject(obj as Mesh);
                objects[obj] = dataobject;
                return(dataobject);
            }

            if (obj is Texture)
            {
                TextureObject dataobject = null;

                dataobject = new TextureObject(obj as Texture);
                //dataobject = new TextureObject(Texture2D.whiteTexture);
                objects[obj] = dataobject;

                return(dataobject);
            }

            if (obj is FxCanvasObject)
            {
                var dataobject = new CanvasObject(obj as FxCanvasObject);
                objects[obj] = dataobject;
                return(dataobject);
            }

            if (obj is AnimationClip)
            {
                var dataobject = new AnimationClipObject(obj as AnimationClip);
                objects[obj] = dataobject;
                return(dataobject);
            }

            return(null);
        }