Ejemplo n.º 1
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public virtual void Write(ISavableWriter output)
        {
            output.Write("Name", _name);
            output.WriteSavable <Transform>("LocalTransform", _localTransform);
            output.WriteSavable <SceneHints>("SceneHints", _sceneHints);
            output.WriteSavable <LightCollection>("LocalLights", _localLights);

            List <ISavable> savableControllers = new List <ISavable>();

            for (int i = 0; i < _controllers.Count; i++)
            {
                ISpatialController controller = _controllers[i];
                if (controller is ISavable)
                {
                    savableControllers.Add(controller as ISavable);
                }
            }

            if (savableControllers.Count > 0)
            {
                output.Write("HasControllers", true);
                output.WriteSavable <ISavable>("Controllers", savableControllers.ToArray());
            }
            else
            {
                output.Write("HasControllers", false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Serializes this OrientedBoundingBox.
 /// </summary>
 /// <param name="output">Output to write to</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.Write("Extents", m_extents);
     output.Write("XAxis", m_xAxis);
     output.Write("YAxis", m_yAxis);
     output.Write("ZAxis", m_zAxis);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public override void Write(ISavableWriter output)
 {
     output.WriteEnum <TextureAddressMode>("AddressU", _impl.AddressU);
     output.WriteEnum <TextureAddressMode>("AddressV", _impl.AddressV);
     output.WriteEnum <TextureAddressMode>("AddressW", _impl.AddressW);
     output.WriteEnum <TextureFilter>("Filter", _impl.Filter);
     output.Write("MipMapLevelOfDetailBias", _impl.MipMapLevelOfDetailBias);
     output.Write("MaxAnisotropy", _impl.MaxAnisotropy);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public void Write(ISavableWriter output)
 {
     output.Write("GlobalAmbient", _globalAmbient);
     output.Write("MaxLights", _maxLights);
     output.Write("IsEnabled", _isEnabled);
     Light[] lights = new Light[_lightCount];
     Array.Copy(_lights, lights, _lightCount);
     output.WriteSavable <Light>("Lights", lights);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public override void Write(ISavableWriter output)
 {
     output.WriteEnum <CullMode>("Cull", _impl.Cull);
     output.WriteEnum <VertexWinding>("VertexWinding", _impl.VertexWinding);
     output.WriteEnum <FillMode>("Fill", _impl.Fill);
     output.Write("DepthBias", _impl.DepthBias);
     output.Write("SlopeScaledDepthBias", _impl.SlopeScaledDepthBias);
     output.Write("EnableMultiSampleAntiAlias", _impl.EnableMultiSampleAntiAlias);
     output.Write("EnableScissorTest", _impl.EnableScissorTest);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public void Write(ISavableWriter output)
 {
     output.Write("Name", base.Name);
     output.WriteSavable <VertexDeclaration>("VertexDeclaration", _impl.VertexDeclaration);
     output.Write("VertexCount", _impl.VertexCount);
     output.WriteEnum <ResourceUsage>("BufferUsage", _impl.BufferUsage);
     byte[] byteBuffer = new byte[_impl.VertexDeclaration.VertexStride * _impl.VertexCount];
     GetData <byte>(byteBuffer);
     output.Write("VertexData", byteBuffer);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public void Write(ISavableWriter output)
        {
            output.Write("Name", base.Name);
            output.Write("IndexCount", _impl.IndexCount);
            output.WriteEnum <IndexFormat>("IndexFormat", _impl.IndexFormat);
            output.WriteEnum <ResourceUsage>("BufferUsage", _impl.BufferUsage);
            int formatBytes = (_impl.IndexFormat == IndexFormat.ThirtyTwoBits) ? 4 : 2;

            byte[] byteBuffer = new byte[_impl.IndexCount * formatBytes];
            output.Write("IndexData", byteBuffer);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public void Write(ISavableWriter output)
 {
     output.Write("VertexStride", _vertexStride);
     output.Write("ElementCount", _elements.Length);
     for (int i = 0; i < _elements.Length; i++)
     {
         VertexElement element = _elements[i];
         output.WriteEnum <VertexSemantic>("SemanticName", element.SemanticName);
         output.Write("SemanticIndex", element.SemanticIndex);
         output.WriteEnum <VertexFormat>("Format", element.Format);
         output.Write("Offset", element.Offset);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Serializes this Light.
 /// </summary>
 /// <param name="output">Output to be written to</param>
 public virtual void Write(ISavableWriter output)
 {
     output.Write("Name", _name);
     output.Write("Ambient", _ambient);
     output.Write("Diffuse", _diffuse);
     output.Write("Specular", _specular);
     output.Write("Constant", _constant);
     output.Write("Linear", _linear);
     output.Write("Quadratic", _quadratic);
     output.Write("Attenuate", _attenuate);
     output.Write("IsEnabled", _enabled);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Serializes this SceneHints.
 /// </summary>
 /// <param name="output">Output to be written to</param>
 public void Write(ISavableWriter output)
 {
     output.WriteEnum <CullHint>("CullHint", _cullHint);
     output.WriteEnum <PickingHint>("PickingHint", _pickHint);
     output.WriteEnum <LightCombineHint>("LightCombineHint", _lightHint);
     output.WriteEnum <TransparencyType>("TransparencyType", _transHint);
     output.WriteEnum <RenderBucketType>("RenderBucketType", _bucketType);
     output.Write("OrthoOrder", _orthoOrder);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           width    = _impl.Width;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Width", width);
            output.Write("MipCount", mipCount);

            for (int i = 0; i < mipCount; i++)
            {
                byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(width, 1, 1, i, format)];
                _impl.GetData <byte>(byteBuffer, i, 0, width >> i, 0, byteBuffer.Length);
                output.Write(String.Format("MipLevel{0}", i.ToString()), byteBuffer);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           size     = _impl.Size;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Size", size);
            output.Write("MipCount", mipCount);

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < mipCount; j++)
                {
                    byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(size, size, 1, j, format)];
                    _impl.GetData <byte>((CubeMapFace)i, byteBuffer, j, null, 0, byteBuffer.Length);
                    output.Write(String.Format("CubeMapFace: {0}, MipLevel{1}", ((CubeMapFace)i).ToString(), j), byteBuffer);
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           width    = _impl.Width;
            int           height   = _impl.Height;
            int           depth    = _impl.Depth;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Width", width);
            output.Write("Height", height);
            output.Write("Depth", depth);
            output.Write("MipCount", mipCount);

            int width2  = width;
            int height2 = height;
            int depth2  = depth;

            for (int i = 0; i < mipCount; i++)
            {
                byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(width, height, depth, i, format)];
                _impl.GetData <byte>(byteBuffer, i, 0, width2, 0, height2, 0, depth2, 0, byteBuffer.Length);
                width2  = System.Math.Max(width2 >> 1, 1);
                height2 = System.Math.Max(height2 >> 1, 1);
                depth2  = System.Math.Max(depth2 >> 1, 1);
                output.Write(String.Format("MipLevel{0}", i.ToString()), byteBuffer);
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public virtual void Write(ISavableWriter output)
 {
     output.Write("Name", _name);
     output.Write("Viewport", new Vector4(_viewport.X, _viewport.Y, _viewport.Width, _viewport.Height));
     output.Write("ViewportDepth", new Vector2(_viewport.MinDepth, _viewport.MaxDepth));
     output.Write("Position", _position);
     output.Write("Up", _up);
     output.Write("Direction", _direction);
     output.WriteEnum <ProjectionMode>("ProjectionMode", _projectionMode);
     output.Write("ProjectionMatrix", _proj);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Serializes this Mesh.
 /// </summary>
 /// <param name="output">Output to be written to</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.Write("Extents", _extents);
     output.Write("Center", _center);
     output.Write("XAxis", _xAxis);
     output.Write("YAxis", _yAxis);
     output.Write("ZAxis", _zAxis);
     output.Write("InsideOut", _insideOut);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.Write("FlipImage", m_flip);
     output.Write("GenerateMipMaps", m_genMipMaps);
     output.Write("ResizePowerOfTwo", m_resizePowerOfTwo);
     output.WriteEnum <TextureConversionFormat>("TextureFormat", m_textureFormat);
     output.Write("ColorKey", m_colorKey);
     output.Write("ColorKeyEnabled", m_colorKeyEnabled);
     output.Write("PreMultiplyAlpha", m_preMultiplyAlpha);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Serializes the transform.
 /// </summary>
 /// <param name="output">Output to write to</param>
 public void Write(ISavableWriter output)
 {
     output.Write("Scale", _scale);
     output.Write("Rotation", _rotation);
     output.Write("Translation", _translation);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public virtual void Write(ISavableWriter output)
 {
     output.Write("Name", _name);
     output.Write("IsEnabled", _isEnabled);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Serializes this BoundingBox.
 /// </summary>
 /// <param name="output">Output to write to</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.Write("Extents", m_extents);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Serializes this Effect.
 /// </summary>
 /// <param name="output">Output to write to</param>
 public void Write(ISavableWriter output)
 {
     output.Write("Name", _impl.Name);
     output.Write("EffectCode", _cachedByteCode);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.WriteEnum <NormalGeneration>("NormalGeneration", _normalGen);
     output.Write("CreaseAngle", _creaseAngle);
     output.Write("GenerateTangentBasis", _generateTangentBasis);
     output.Write("FlipUVCoordinates", _flipUVs);
     output.Write("SwapWindingOrder", _swapWindingOrder);
     output.Write("Scale", _scale);
     output.Write("XAxisRotation", _xAngle);
     output.Write("YAxisRotation", _yAngle);
     output.Write("ZAxisRotation", _zAngle);
     output.Write("UserMaterialFile", _userMaterialFile);
     output.Write("MaterialNamesCorrespondToGeometry", _materialNamesCorrespondToGeometry);
     output.Write("PreferLitMaterials", _preferLitMaterials);
     output.Write("ImportLights", _importLights);
     output.WriteSavable <ImageLoaderParameters>("ImageLoaderParameters", _imageParameters);
     output.Write("TexturePath", _texturePath);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Serializes this BoundingVolume.
 /// </summary>
 /// <param name="output">Output to write to</param>
 public virtual void Write(ISavableWriter output)
 {
     output.Write("Center", m_center);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public virtual void Write(ISavableWriter output)
 {
     output.Write("OverrideCache", _overrideCache);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public override void Write(ISavableWriter output)
 {
     base.Write(output);
     output.Write("MaterialName", _materialName);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public void Write(ISavableWriter output)
 {
     output.Write("Name", _name);
     output.WriteSavable <Material>("Materials", _materials.ToArray());
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Serializes the object and writes it to the output.
 /// </summary>
 /// <param name="output">Savable Output</param>
 public void Write(ISavableWriter output)
 {
     output.Write("ExternalReference", _fileName);
     output.WriteSavable <LoaderParameters>("LoaderParameters", _loaderParams);
 }