Esempio n. 1
0
        //    *
        //	 * Builds the mesh into the given TriangleBuffer
        //	 * @param buffer The TriangleBuffer on where to append the mesh.
        //
        //
        //ORIGINAL LINE: void addToTriangleBuffer(TriangleBuffer& buffer) const
        public override void addToTriangleBuffer(ref TriangleBuffer buffer)
        {
            //int offset = 0;
            // Generate the pseudo-box shape
            PlaneGenerator pg = new PlaneGenerator();

            pg.setUTile(mUTile).setVTile(mVTile);
            if (mTransform != null)
            {
                pg.setScale(mScale);
                pg.setOrientation(mOrientation);
            }

            pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX).setNormal(Vector3.NEGATIVE_UNIT_Z).setPosition((.5f * mSizeZ + mChamferSize) * (mOrientation * Vector3.NEGATIVE_UNIT_Z)).addToTriangleBuffer(ref buffer);
            buffer.rebaseOffset();
            pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX).setNormal(Vector3.UNIT_Z).setPosition((.5f * mSizeZ + mChamferSize) * (mOrientation * Vector3.UNIT_Z)).addToTriangleBuffer(ref buffer);
            buffer.rebaseOffset();
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX).setNormal(Vector3.NEGATIVE_UNIT_Y).setPosition((.5f * mSizeY + mChamferSize) * (mOrientation * Vector3.NEGATIVE_UNIT_Y)).addToTriangleBuffer(ref buffer);
            buffer.rebaseOffset();
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX).setNormal(Vector3.UNIT_Y).setPosition((.5f * mSizeY + mChamferSize) * (mOrientation * Vector3.UNIT_Y)).addToTriangleBuffer(ref buffer);
            buffer.rebaseOffset();
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegY).setSizeX(mSizeZ).setSizeY(mSizeY).setNormal(Vector3.NEGATIVE_UNIT_X).setPosition((.5f * mSizeX + mChamferSize) * (mOrientation * Vector3.NEGATIVE_UNIT_X)).addToTriangleBuffer(ref buffer);
            buffer.rebaseOffset();
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegY).setSizeX(mSizeZ).setSizeY(mSizeY).setNormal(Vector3.UNIT_X).setPosition((.5f * mSizeX + mChamferSize) * (mOrientation * Vector3.UNIT_X)).addToTriangleBuffer(ref buffer);

            // Generate the corners
            _addCorner(ref buffer, true, true, true);
            _addCorner(ref buffer, true, true, false);
            _addCorner(ref buffer, true, false, true);
            _addCorner(ref buffer, true, false, false);
            _addCorner(ref buffer, false, true, true);
            _addCorner(ref buffer, false, true, false);
            _addCorner(ref buffer, false, false, true);
            _addCorner(ref buffer, false, false, false);

            // Generate the edges
            _addEdge(ref buffer, -1, -1, 0);
            _addEdge(ref buffer, -1, 1, 0);
            _addEdge(ref buffer, 1, -1, 0);
            _addEdge(ref buffer, 1, 1, 0);
            _addEdge(ref buffer, -1, 0, -1);
            _addEdge(ref buffer, -1, 0, 1);
            _addEdge(ref buffer, 1, 0, -1);
            _addEdge(ref buffer, 1, 0, 1);
            _addEdge(ref buffer, 0, -1, -1);
            _addEdge(ref buffer, 0, -1, 1);
            _addEdge(ref buffer, 0, 1, -1);
            _addEdge(ref buffer, 0, 1, 1);
        }
Esempio n. 2
0
        //    *
        //	 * Builds the mesh into the given TriangleBuffer
        //	 * @param buffer The TriangleBuffer on where to append the mesh.
        //

        //ORIGINAL LINE: void addToTriangleBuffer(TriangleBuffer& buffer) const
        public override void addToTriangleBuffer(ref TriangleBuffer buffer)
        {
            PlaneGenerator pg = new PlaneGenerator();

            pg.setUTile(mUTile).setVTile(mVTile);
            if (mTransform != null)
            {
                pg.setScale(mScale);
                pg.setOrientation(mOrientation);
            }
            pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX).setNormal(Vector3.NEGATIVE_UNIT_Z).setPosition(mScale * (mPosition + .5f * mSizeZ * (mOrientation * Vector3.NEGATIVE_UNIT_Z))).addToTriangleBuffer(ref buffer);
            pg.setNumSegX(mNumSegY).setNumSegY(mNumSegX).setSizeX(mSizeY).setSizeY(mSizeX).setNormal(Vector3.UNIT_Z).setPosition(mScale * (mPosition + .5f * mSizeZ * (mOrientation * Vector3.UNIT_Z))).addToTriangleBuffer(ref buffer);
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX).setNormal(Vector3.NEGATIVE_UNIT_Y).setPosition(mScale * (mPosition + .5f * mSizeY * (mOrientation * Vector3.NEGATIVE_UNIT_Y))).addToTriangleBuffer(ref buffer);
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegX).setSizeX(mSizeZ).setSizeY(mSizeX).setNormal(Vector3.UNIT_Y).setPosition(mScale * (mPosition + .5f * mSizeY * (mOrientation * Vector3.UNIT_Y))).addToTriangleBuffer(ref buffer);
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegY).setSizeX(mSizeZ).setSizeY(mSizeY).setNormal(Vector3.NEGATIVE_UNIT_X).setPosition(mScale * (mPosition + .5f * mSizeX * (mOrientation * Vector3.NEGATIVE_UNIT_X))).addToTriangleBuffer(ref buffer);
            pg.setNumSegX(mNumSegZ).setNumSegY(mNumSegY).setSizeX(mSizeZ).setSizeY(mSizeY).setNormal(Vector3.UNIT_X).setPosition(mScale * (mPosition + .5f * mSizeX * (mOrientation * Vector3.UNIT_X))).addToTriangleBuffer(ref buffer);
        }