Esempio n. 1
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);
            writer.Write(1u);   // Parent node count, currently not supported
            writer.Write("");   // Currently only the root is valid
            writer.Write(Transform);
        }
Esempio n. 2
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);
            writer.Write(1u);    // Parent node count
            writer.Write("");    // Parent node name, currently only root supported
            writer.Write(Transform);
            writer.Write(ResourceName);
        }
Esempio n. 3
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);
            writer.Write(1u);    // Parent node count
            writer.Write(Parent?.Name ?? "");
            writer.Write(Transform);
            writer.Write(ResourceName);
            writer.Write((uint)Visibility);
        }
Esempio n. 4
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            Debug.Assert(DiffuseColors == null || DiffuseColors?.Length <= 1 || DiffuseColors?.Length == Positions?.Length);

            writer.Write(_MeshDeclaration.Name);
            writer.Write(_MeshDeclaration.ChainIndex);

            writer.Write((uint)Indices.Length / 3u);
            writer.Write((uint)Positions.Length);
            writer.Write((uint)(Normals?.Length ?? 0));       // Normal Count
            writer.Write((uint)(DiffuseColors?.Length ?? 0)); // Diffuse Color Count, currently not supported
            writer.Write(0u);                                 // Specular Color Count, currently not supported
            writer.Write(0u);                                 // Texture Coord Count, currently not supported

            for (int i = 0; i < Positions.Length; i++)
            {
                var pos = Positions[i];
                writer.Write((float)pos.X);
                writer.Write((float)pos.Y);
                writer.Write((float)pos.Z);
            }

            for (int i = 0; i < Normals?.Length; i++)
            {
                var dir = Normals[i];
                writer.Write((float)dir.X);
                writer.Write((float)dir.Y);
                writer.Write((float)dir.Z);
            }

            for (int i = 0; i < DiffuseColors?.Length; i++)
            {
                var color = DiffuseColors[i];
                writer.Write((float)color.Red);
                writer.Write((float)color.Green);
                writer.Write((float)color.Blue);
                writer.Write((float)1.0f);
            }

            for (int face = 0; face < Indices.Length / 3u; face++)
            {
                writer.Write((uint)0);    // Shading ID
                for (int index = 0; index < 3; index++)
                {
                    writer.Write((uint)Indices[face * 3 + index]);
                    if (Normals?.Length > 0)
                    {
                        writer.Write((uint)Indices[face * 3 + index]);
                    }

                    if (DiffuseColors?.Length > 0)
                    {
                        writer.Write(DiffuseColors.Length == 1 ? 0u : (uint)Indices[face * 3 + index]);
                    }
                }
            }
        }
Esempio n. 5
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);
            uint attributes = 1u;  //  1 =  Light Enabled

            writer.Write(attributes);
            writer.Write((byte)Type);
            writer.Write(Color.Red);
            writer.Write(Color.Green);
            writer.Write(Color.Blue);
            writer.Write(1.0f);   // Reserved, must be 1.0
            writer.Write(AttenuationConstant);
            writer.Write(AttenuationLinear);
            writer.Write(AttenuationQuadratic);
            writer.Write(SpotAngle);
            writer.Write(Intensity);
        }
Esempio n. 6
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);

            uint attributes = 0;

            if (_AmbientColor.HasValue)
            {
                attributes |= 1;
            }
            if (_DiffuseColor.HasValue)
            {
                attributes |= 2;
            }
            if (_SpecularColor.HasValue)
            {
                attributes |= 4;
            }
            if (_EmmisiveColor.HasValue)
            {
                attributes |= 8;
            }
            if (_Reflectivity.HasValue)
            {
                attributes |= 16;
            }
            if (_Opacity.HasValue)
            {
                attributes |= 32;
            }
            writer.Write(attributes);

            writer.Write(AmbientColor);
            writer.Write(DiffuseColor);
            writer.Write(SpecularColor);
            writer.Write(EmmisiveColor);
            writer.Write(Reflectivity);
            writer.Write(Opacity);
        }
Esempio n. 7
0
        //--------------------------------------------------------------------------------------------------

        protected override void WriteBlockData(U3dWriter writer)
        {
            writer.Write(Name);
            writer.Write(1u);    // Parent node count
            writer.Write("");    // Parent node name, currently only root supported
            writer.Write(Transform);
            writer.Write(ResourceName);

            writer.Write((uint)3);  // ViewNode Attributes: 2 = orthographic projection, 1 = screen position units: expressed as percentage of screen dimension
            writer.Write(NearClip);
            writer.Write(FarClip);
            writer.Write(OrthographicHeight);

            writer.Write(1.0f);     // View Port Width
            writer.Write(1.0f);     // View Port Height
            writer.Write(0.0f);     // View Port Horizontal Position
            writer.Write(0.0f);     // View Port Vertical Position

            writer.Write(0u);       // Backdrop Count

            writer.Write(0u);       // Overlay Count
        }