예제 #1
0
 /// <summary>
 /// Builds the structure.
 /// </summary>
 /// <param name="buildOptions">Some generic options for structure building</param>
 public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
 {
     if (buildOptions.IsHighDetail)
     {
         return(m_vertexStructure);
     }
     else
     {
         return(m_vertexStructureLowDetail);
     }
 }
예제 #2
0
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            VertexStructure result = new VertexStructure();

            result.CreateOrGetExistingSurface(MaterialProperties.Empty)
            .BuildCube24V(
                new Vector3(-0.5f, -0.5f, -0.5f),
                new Vector3(1f, 1f, 1f),
                Color4.Transparent);
            return(result);
        }
예제 #3
0
        /// <summary>
        /// Builds all vertex structures for the given detail level.
        /// </summary>
        /// <param name="buildOptions">Some generic options for structure building</param>
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            VertexStructure structureFromChild = m_objTypeToStack.BuildStructure(buildOptions);

            structureFromChild.EnsureNotNull(nameof(structureFromChild));

            BoundingBox childStructBox   = structureFromChild.GenerateBoundingBox();
            Vector3     correctionVector = -childStructBox.GetBottomCenter();

            // Copy metadata infomration of the VertexStructures
            VertexStructure result = structureFromChild.Clone(
                copyGeometryData: false,
                capacityMultiplier: m_stackSize);

            // Build geometry
            for (int loop = 0; loop < m_stackSize; loop++)
            {
                float   actYCorrection  = childStructBox.Height * loop;
                Vector3 localCorrection = new Vector3(correctionVector.X, correctionVector.Y + actYCorrection, correctionVector.Z);

                int baseVertex = loop * structureFromChild.CountVertices;
                foreach (Vertex actVertex in structureFromChild.Vertices)
                {
                    // Change vertex properties based on stack position
                    Vertex changedVertex = actVertex;
                    changedVertex.Position = changedVertex.Position + localCorrection;
                    if (loop % 2 == 1)
                    {
                        changedVertex.Color = changedVertex.Color.ChangeColorByLight(0.05f);
                    }

                    // Add the vertex
                    result.AddVertex(changedVertex);
                }

                // Clone all surfaces
                foreach (VertexStructureSurface actSurfaceFromChild in structureFromChild.Surfaces)
                {
                    VertexStructureSurface newSurface = result.CreateSurface(actSurfaceFromChild.CountTriangles);
                    foreach (Triangle actTriangle in actSurfaceFromChild.Triangles)
                    {
                        newSurface.AddTriangle(
                            baseVertex + actTriangle.Index1,
                            baseVertex + actTriangle.Index2,
                            baseVertex + actTriangle.Index3);
                    }
                }
            }

            return(result);
        }
예제 #4
0
        /// <summary>
        /// Builds the structures.
        /// </summary>
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            VertexStructure result = new VertexStructure();

            // Calculate parameters
            Vector3 firstCoordinate = new Vector3(
                -((TilesX * TileWidth) / 2f),
                0f,
                -((TilesZ * TileWidth) / 2f));
            float tileWidthX     = this.TileWidth;
            float tileWidthZ     = this.TileWidth;
            float fieldWidth     = tileWidthX * TilesX;
            float fieldDepth     = tileWidthZ * TilesZ;
            float fieldWidthHalf = fieldWidth / 2f;
            float fieldDepthHalf = fieldDepth / 2f;

            int tileMiddleX = (TilesX % 2 == 0) && (this.HighlightXZLines) ? this.TilesX / 2 : 1;
            int tileMiddleZ = (TilesZ % 2 == 0) && (this.HighlightXZLines) ? this.TilesZ / 2 : 1;

            // Define lower ground structure
            if (this.GenerateGround)
            {
                VertexStructureSurface lowerGround = result.CreateSurface();
                lowerGround.EnableTextureTileMode(new Vector2(TileWidth, TileWidth));
                lowerGround.BuildRect4V(
                    new Vector3(-fieldWidthHalf, -0.01f, -fieldDepthHalf),
                    new Vector3(fieldWidthHalf, -0.01f, -fieldDepthHalf),
                    new Vector3(fieldWidthHalf, -0.01f, fieldDepthHalf),
                    new Vector3(-fieldWidthHalf, -0.01f, fieldDepthHalf),
                    new Vector3(0f, 1f, 0f),
                    this.GroundColor);
                lowerGround.Material = this.GroundMaterial;
            }

            // Define line structures
            VertexStructureSurface genStructureDefaultLine = result.CreateSurface();
            VertexStructureSurface genStructureGroupLine   = result.CreateSurface();

            for (int actTileX = 0; actTileX < TilesX + 1; actTileX++)
            {
                Vector3 localStart = firstCoordinate + new Vector3(actTileX * tileWidthX, 0f, 0f);
                Vector3 localEnd   = localStart + new Vector3(0f, 0f, tileWidthZ * TilesZ);

                Color4 actLineColor = this.LineColor;
                float  devider      = actTileX % this.GroupTileCount == 0 ? this.LineSmallDevider : this.LineBigDevider;
                if (this.HighlightXZLines && (actTileX == tileMiddleX))
                {
                    actLineColor = this.ZLineHighlightColor;
                    devider      = this.LineSmallDevider;
                }

                VertexStructureSurface targetStruture = actTileX % this.GroupTileCount == 0 ? genStructureGroupLine : genStructureDefaultLine;
                targetStruture.BuildRect4V(
                    localStart - new Vector3(tileWidthX / devider, 0f, 0f),
                    localStart + new Vector3(tileWidthX / devider, 0f, 0f),
                    localEnd + new Vector3(tileWidthX / devider, 0f, 0f),
                    localEnd - new Vector3(tileWidthX / devider, 0f, 0f),
                    actLineColor);
                if (this.BuildBackFaces)
                {
                    targetStruture.BuildRect4V(
                        localEnd - new Vector3(tileWidthX / devider, 0f, 0f),
                        localEnd + new Vector3(tileWidthX / devider, 0f, 0f),
                        localStart + new Vector3(tileWidthX / devider, 0f, 0f),
                        localStart - new Vector3(tileWidthX / devider, 0f, 0f),
                        actLineColor);
                }
            }
            for (int actTileZ = 0; actTileZ < TilesZ + 1; actTileZ++)
            {
                Vector3 localStart = firstCoordinate + new Vector3(0f, 0f, actTileZ * tileWidthZ);
                Vector3 localEnd   = localStart + new Vector3(tileWidthX * TilesX, 0f, 0f);

                Color4 actLineColor = this.LineColor;
                float  devider      = actTileZ % this.GroupTileCount == 0 ? this.LineSmallDevider : this.LineBigDevider;
                if (this.HighlightXZLines && (actTileZ == tileMiddleZ))
                {
                    actLineColor = this.XLineHighlightColor;
                    devider      = this.LineSmallDevider;
                }

                VertexStructureSurface targetStruture = actTileZ % this.GroupTileCount == 0 ? genStructureGroupLine : genStructureDefaultLine;
                targetStruture.BuildRect4V(
                    localStart + new Vector3(0f, 0f, tileWidthZ / devider),
                    localStart - new Vector3(0f, 0f, tileWidthZ / devider),
                    localEnd - new Vector3(0f, 0f, tileWidthZ / devider),
                    localEnd + new Vector3(0f, 0f, tileWidthZ / devider),
                    actLineColor);
                if (this.BuildBackFaces)
                {
                    targetStruture.BuildRect4V(
                        localEnd + new Vector3(0f, 0f, tileWidthZ / devider),
                        localEnd - new Vector3(0f, 0f, tileWidthZ / devider),
                        localStart - new Vector3(0f, 0f, tileWidthZ / devider),
                        localStart + new Vector3(0f, 0f, tileWidthZ / devider),
                        actLineColor);
                }
            }
            genStructureDefaultLine.Material = this.LineMaterial;
            genStructureGroupLine.Material   = this.LineMaterial;
            if (genStructureDefaultLine.CountTriangles == 0)
            {
                result.RemoveSurface(genStructureDefaultLine);
            }
            if (genStructureGroupLine.CountTriangles == 0)
            {
                result.RemoveSurface(genStructureGroupLine);
            }

            // Return all generated structures
            return(result);
        }
예제 #5
0
 /// <summary>
 /// Builds a VertexStructure using given parameters (like DetailLevel).
 /// </summary>
 /// <param name="buildOptions">Some generic options for structure building</param>
 public abstract VertexStructure BuildStructure(StructureBuildOptions buildOptions);
예제 #6
0
        /// <summary>
        /// Builds the structure needed for the pallet
        /// </summary>
        /// <param name="buildOptions">Some generic options for structure building</param>
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            VertexStructure        result  = new VertexStructure();
            VertexStructureSurface surface = result.CreateSurface();

            //Build pallet
            #region -----------------------------------------------------------
            if (buildOptions.IsHighDetail)
            {
                float middleFront            = m_width / 2f;
                float middleSide             = m_depth / 2f;
                float middleFrontBegin       = middleFront - m_bigFooterWidth / 2f;
                float middleSideBegin        = middleSide - m_bigFooterWidth / 2f;
                float lastBeginSmall         = m_width - m_smallFooterWidth;
                float lastBeginBig           = m_depth - m_bigFooterWidth;
                float footerHeight           = m_palletHeight - m_boardHeight * 3f;
                float quarterFrontBegin      = ((m_bigFooterWidth / 2f) + ((middleFront - (m_bigFooterWidth / 2f)) / 2f)) - (m_smallFooterWidth / 2f); // +(middleFront / 2f - m_smallFooterWidth / 2f);
                float threeQuarterFrontBegin = middleFront + (middleFront - quarterFrontBegin - m_smallFooterWidth);                                   //(middleFront / 2f) * 3f - m_smallFooterWidth / 2f;

                for (int loop = 0; loop < m_palletCount; loop++)
                {
                    Color4 actColor  = loop % 2 == 0 ? m_palletColor : m_palletCollor2;
                    float  actYCoord = m_palletHeight * loop;

                    surface.Material = m_palletMaterial;

                    //Build 3 board on bottom
                    surface.BuildCube24V(new Vector3(0f, actYCoord, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(middleFrontBegin, actYCoord, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(lastBeginSmall, actYCoord, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), actColor);

                    //Build 9 footers
                    surface.BuildCubeSides16V(new Vector3(0f, m_boardHeight + actYCoord, 0f), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(0f, m_boardHeight + actYCoord, middleSideBegin), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(0f, m_boardHeight + actYCoord, lastBeginBig), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight + actYCoord, 0f), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight + actYCoord, middleSideBegin), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight + actYCoord, lastBeginBig), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight + actYCoord, 0f), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight + actYCoord, middleSideBegin), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);
                    surface.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight + actYCoord, lastBeginBig), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), actColor);

                    //Build boards above footers
                    surface.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight + actYCoord, 0f), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), actColor);
                    surface.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight + actYCoord, middleSideBegin), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), actColor);
                    surface.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight + actYCoord, lastBeginBig), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), actColor);

                    //Build top boards
                    float localYPos = m_palletHeight - m_boardHeight;
                    surface.BuildCube24V(new Vector3(0f, localYPos + actYCoord, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(middleFrontBegin, localYPos + actYCoord, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(m_width - m_bigFooterWidth, localYPos + actYCoord, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(quarterFrontBegin, localYPos + actYCoord, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), actColor);
                    surface.BuildCube24V(new Vector3(threeQuarterFrontBegin, localYPos + actYCoord, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), actColor);
                }
            }
            else
            {
                for (int loop = 0; loop < m_palletCount; loop++)
                {
                    Color4 actColor = loop % 2 == 0 ? m_palletColor : m_palletCollor2;
                    surface.BuildCube24V(
                        new Vector3(0f, m_palletHeight * loop, 0f),
                        new Vector3(m_width, m_palletHeight, m_depth),
                        actColor);
                }
            }
            #endregion -----------------------------------------------------------

            Matrix4x4 rotMatrix = Matrix4x4.CreateRotationY(EngineMath.RAD_90DEG);

            result.UpdateVerticesUsingRelocationBy(new Vector3(-m_width / 2f, 0f, -m_depth / 2f));
            result.CalculateTangentsAndBinormals();
            result.TransformVertices(rotMatrix);
            result.FitToCenteredCube(1f, FitToCuboidMode.Stretch, SpacialOriginLocation.LowerCenter);

            return(result);
        }
예제 #7
0
        /// <summary>
        /// Builds the structure.
        /// </summary>
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            VertexStructure result = new VertexStructure();

            // Hold dictionary containg materials and corresponding structures
            Dictionary <NamedOrGenericKey, VertexStructureSurface> materialRelated = new Dictionary <NamedOrGenericKey, VertexStructureSurface>();

            // Build bottom structure
            VertexStructureSurface bottomSurface = result.CreateSurface();

            bottomSurface.Material            = m_bottomMaterial;
            materialRelated[m_bottomMaterial] = bottomSurface;

            // Calculate half vector of total ground size.
            Vector2 totalHalfSize = new Vector2(m_totalSizeWithoutBorder.X / 2f, m_totalSizeWithoutBorder.Y / 2f);
            Vector2 tileHalfSize  = new Vector2(m_tileSize.X / 2f, m_tileSize.Y / 2f);

            // Build all tiles
            foreach (FloorTile actTile in m_groundTiles)
            {
                // Get the material of the tile
                NamedOrGenericKey actMaterial = actTile.Material;
                if (actMaterial.IsEmpty)
                {
                    actMaterial = m_groundMaterial;
                }

                // Get surface object
                VertexStructureSurface actSurface = null;
                if (materialRelated.ContainsKey(actMaterial))
                {
                    actSurface = materialRelated[actMaterial];
                }
                else
                {
                    actSurface                   = result.CreateSurface();
                    actSurface.Material          = actMaterial;
                    materialRelated[actMaterial] = actSurface;
                }

                // Get position of the tile
                Vector3 tilePosition = new Vector3(
                    (actTile.XPos * m_tileSize.X) - totalHalfSize.X,
                    0f,
                    (actTile.YPos * m_tileSize.Y) - totalHalfSize.Y);

                // Add tile information to current VertexStructures
                actSurface.BuildCubeTop4V(
                    new Vector3(tilePosition.X, -m_height, tilePosition.Z),
                    new Vector3(m_tileSize.X, m_height, m_tileSize.Y),
                    Color4.White);
                bottomSurface.BuildCubeBottom4V(
                    new Vector3(tilePosition.X, -m_height, tilePosition.Z),
                    new Vector3(m_tileSize.X, m_height, m_tileSize.Y),
                    Color4.White);
            }

            // Build all borders
            VertexStructureSurface borderSurface = null;

            if (materialRelated.ContainsKey(m_borderMaterial))
            {
                borderSurface = materialRelated[m_borderMaterial];
            }
            else
            {
                borderSurface                     = result.CreateSurface();
                borderSurface.Material            = m_borderMaterial;
                materialRelated[m_borderMaterial] = borderSurface;
            }
            foreach (BorderInformation actBorder in m_borders)
            {
                if (m_borderSize <= 0f)
                {
                    Vector3 tilePosition = new Vector3(
                        (actBorder.TileXPos * m_tileSize.X) - totalHalfSize.X,
                        0f,
                        (actBorder.TileYPos * m_tileSize.Y) - totalHalfSize.Y);

                    //Build simple borders
                    switch (actBorder.Location)
                    {
                    case BorderLocation.Left:
                        borderSurface.BuildRect4V(
                            new Vector3(tilePosition.X, -m_height, tilePosition.Z),
                            new Vector3(tilePosition.X, 0f, tilePosition.Z),
                            new Vector3(tilePosition.X, 0f, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X, -m_height, tilePosition.Z + m_tileSize.Y));
                        break;

                    case BorderLocation.Top:
                        borderSurface.BuildRect4V(
                            new Vector3(tilePosition.X, -m_height, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X, 0f, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X + m_tileSize.X, 0f, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X + m_tileSize.X, -m_height, tilePosition.Z + m_tileSize.Y));
                        break;

                    case BorderLocation.Right:
                        borderSurface.BuildRect4V(
                            new Vector3(tilePosition.X + m_tileSize.X, -m_height, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X + m_tileSize.X, 0f, tilePosition.Z + m_tileSize.Y),
                            new Vector3(tilePosition.X + m_tileSize.X, 0f, tilePosition.Z),
                            new Vector3(tilePosition.X + m_tileSize.X, -m_height, tilePosition.Z));
                        break;

                    case BorderLocation.Bottom:
                        borderSurface.BuildRect4V(
                            new Vector3(tilePosition.X + m_tileSize.X, -m_height, tilePosition.Z),
                            new Vector3(tilePosition.X + m_tileSize.X, 0f, tilePosition.Z),
                            new Vector3(tilePosition.X, 0f, tilePosition.Z),
                            new Vector3(tilePosition.X, -m_height, tilePosition.Z));
                        break;
                    }
                }
                else
                {
                    //Build complex borders
                }
            }

            //Return all generated VertexStructures
            return(result);
        }
예제 #8
0
        /// <summary>
        /// Builds the structure needed for the pallet
        /// </summary>
        /// <param name="buildOptions">Some generic options for structure building</param>
        public override VertexStructure BuildStructure(StructureBuildOptions buildOptions)
        {
            bool createContent = m_contentHeight > 0f;

            // Prepare result array
            VertexStructure result = new VertexStructure();

            VertexStructureSurface surfacePallet  = result.CreateSurface();
            VertexStructureSurface surfaceContent = null;

            if (createContent)
            {
                surfaceContent = result.CreateSurface();
            }

            // Build pallet
            #region -----------------------------------------------------------
            if (buildOptions.IsHighDetail)
            {
                float middleFront            = m_width / 2f;
                float middleSide             = m_depth / 2f;
                float middleFrontBegin       = middleFront - m_bigFooterWidth / 2f;
                float middleSideBegin        = middleSide - m_bigFooterWidth / 2f;
                float lastBeginSmall         = m_width - m_smallFooterWidth;
                float lastBeginBig           = m_depth - m_bigFooterWidth;
                float footerHeight           = m_palletHeight - m_boardHeight * 3f;
                float quarterFrontBegin      = ((m_bigFooterWidth / 2f) + ((middleFront - (m_bigFooterWidth / 2f)) / 2f)) - (m_smallFooterWidth / 2f); // +(middleFront / 2f - m_smallFooterWidth / 2f);
                float threeQuarterFrontBegin = middleFront + (middleFront - quarterFrontBegin - m_smallFooterWidth);                                   //(middleFront / 2f) * 3f - m_smallFooterWidth / 2f;

                surfacePallet.Material = m_palletMaterial;

                // Build 3 board on bottom
                surfacePallet.BuildCube24V(new Vector3(0f, 0f, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(middleFrontBegin, 0f, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(lastBeginSmall, 0f, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), m_palletColor);

                // Build 9 footers
                surfacePallet.BuildCubeSides16V(new Vector3(0f, m_boardHeight, 0f), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(0f, m_boardHeight, middleSideBegin), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(0f, m_boardHeight, lastBeginBig), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight, 0f), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight, middleSideBegin), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(middleFrontBegin, m_boardHeight, lastBeginBig), new Vector3(m_bigFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight, 0f), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight, middleSideBegin), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCubeSides16V(new Vector3(lastBeginSmall, m_boardHeight, lastBeginBig), new Vector3(m_smallFooterWidth, footerHeight, m_bigFooterWidth), m_palletColor);

                // Build boards above footers
                surfacePallet.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight, 0f), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight, middleSideBegin), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(0f, m_boardHeight + footerHeight, lastBeginBig), new Vector3(m_width, m_boardHeight, m_bigFooterWidth), m_palletColor);

                // Build top boards
                float localYPos = m_palletHeight - m_boardHeight;
                surfacePallet.BuildCube24V(new Vector3(0f, localYPos, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(middleFrontBegin, localYPos, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(m_width - m_bigFooterWidth, localYPos, 0f), new Vector3(m_bigFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(quarterFrontBegin, localYPos, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), m_palletColor);
                surfacePallet.BuildCube24V(new Vector3(threeQuarterFrontBegin, localYPos, 0f), new Vector3(m_smallFooterWidth, m_boardHeight, m_depth), m_palletColor);
            }
            else
            {
                surfacePallet.BuildCube24V(
                    new Vector3(0f, 0f, 0f),
                    new Vector3(m_width, m_palletHeight, m_depth),
                    m_palletColor);
            }
            #endregion -----------------------------------------------------------

            // Build content
            #region -----------------------------------------------------------
            if (createContent)
            {
                surfaceContent.Material = m_contentMaterial;
                surfaceContent.BuildCubeSides16V(new Vector3(0f, m_palletHeight, 0f), new Vector3(m_width, m_contentHeight, m_depth), m_contentColor);
                surfaceContent.BuildCubeTop4V(new Vector3(0f, m_palletHeight, 0f), new Vector3(m_width, m_contentHeight, m_depth), m_contentColor);
                surfaceContent.BuildCubeBottom4V(new Vector3(0f, m_palletHeight, 0f), new Vector3(m_width, m_contentHeight, m_depth), m_contentColor);
            }
            #endregion -----------------------------------------------------------

            Matrix4x4 rotMatrix = Matrix4x4.CreateRotationY(EngineMath.RAD_90DEG);
            result.UpdateVerticesUsingRelocationBy(new Vector3(-m_width / 2f, 0f, -m_depth / 2f));
            result.CalculateTangentsAndBinormals();
            result.TransformVertices(rotMatrix);

            return(result);
        }