Ejemplo n.º 1
0
        private static void loadRoom(ref SceneManager sManager)
        {
            var            triangleList         = Parser.getTriangleListFromFile(Constants.Filepath_objectdata, "Room");
            vec4           position             = new vec4(0, 30, 0, 1);
            vec3           scale                = new vec3(3, 3, 3);
            vec4           rotationAxis         = new vec4(0, 1, 0, 1);
            float          angle                = 0;
            mat3           rotationMatrix       = Calculation.calculateRotationMatrix(rotationAxis, angle);
            var            transformationMatrix = Calculation.calculateTransformationMatrix(position, rotationMatrix, scale);
            TriangleObject room = new TriangleObject(objID, transformationMatrix, triangleList);

            objID++;

            sManager.addContent(room);
        }
Ejemplo n.º 2
0
        private static void load3x3x3Cubes(ref SceneManager sManager)
        {
            List <Triangle> _triangleList = Parser.getTriangleListFromFile(Constants.Filepath_objectdata, "Cube");
            //First Layer
            TriangleObject c1 = new TriangleObject(objID, translateC1, _triangleList);

            objID++;
            TriangleObject c2 = new TriangleObject(objID, translateC2, _triangleList);

            objID++;
            TriangleObject c3 = new TriangleObject(objID, translateC3, _triangleList);

            objID++;
            TriangleObject c4 = new TriangleObject(objID, translateC4, _triangleList);

            objID++;
            TriangleObject c5 = new TriangleObject(objID, translateC5, _triangleList);

            objID++;
            TriangleObject c6 = new TriangleObject(objID, translateC6, _triangleList);

            objID++;
            TriangleObject c7 = new TriangleObject(objID, translateC7, _triangleList);

            objID++;
            TriangleObject c8 = new TriangleObject(objID, translateC8, _triangleList);

            objID++;
            TriangleObject c9 = new TriangleObject(objID, translateC9, _triangleList);

            objID++;
            //Second Layer
            TriangleObject c10 = new TriangleObject(objID, translateC10, _triangleList);

            objID++;
            TriangleObject c11 = new TriangleObject(objID, translateC11, _triangleList);

            objID++;
            TriangleObject c12 = new TriangleObject(objID, translateC12, _triangleList);

            objID++;
            TriangleObject c13 = new TriangleObject(objID, translateC13, _triangleList);

            objID++;
            TriangleObject c14 = new TriangleObject(objID, translateC14, _triangleList);

            objID++;
            TriangleObject c15 = new TriangleObject(objID, translateC15, _triangleList);

            objID++;
            TriangleObject c16 = new TriangleObject(objID, translateC16, _triangleList);

            objID++;
            TriangleObject c17 = new TriangleObject(objID, translateC17, _triangleList);

            objID++;
            TriangleObject c18 = new TriangleObject(objID, translateC18, _triangleList);

            objID++;
            //Third Layer
            TriangleObject c19 = new TriangleObject(objID, translateC19, _triangleList);

            objID++;
            TriangleObject c20 = new TriangleObject(objID, translateC20, _triangleList);

            objID++;
            TriangleObject c21 = new TriangleObject(objID, translateC21, _triangleList);

            objID++;
            TriangleObject c22 = new TriangleObject(objID, translateC22, _triangleList);

            objID++;
            TriangleObject c23 = new TriangleObject(objID, translateC23, _triangleList);

            objID++;
            TriangleObject c24 = new TriangleObject(objID, translateC24, _triangleList);

            objID++;
            TriangleObject c25 = new TriangleObject(objID, translateC25, _triangleList);

            objID++;
            TriangleObject c26 = new TriangleObject(objID, translateC26, _triangleList);

            objID++;
            TriangleObject c27 = new TriangleObject(objID, translateC27, _triangleList);

            objID++;

            group3x3x3      = new TriangleObject[] { c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27 };
            groupCorners    = new TriangleObject[] { c1, c3, c7, c9, c19, c21, c25, c27 };
            groupNotCorners = new TriangleObject[] { c2, c4, c5, c6, c8, c10, c11, c12, c13, c14, c15, c16, c17, c18, c20, c22, c23, c24, c26 };

            groupXalignmentLeft   = new TriangleObject[] { c1, c4, c7, c10, c13, c16, c19, c22, c25 };
            groupXalignmentMiddle = new TriangleObject[] { c2, c5, c8, c11, c14, c17, c20, c23, c26 };
            groupXalignmentRight  = new TriangleObject[] { c3, c6, c9, c12, c15, c18, c21, c24, c27 };

            groupYalignmentBottom = new TriangleObject[] { c7, c8, c9, c16, c17, c18, c25, c26, c27 };
            groupYalignmentMiddle = new TriangleObject[] { c4, c5, c6, c13, c14, c15, c22, c23, c24 };
            groupYalignmentTop    = new TriangleObject[] { c1, c2, c3, c10, c11, c12, c19, c20, c21 };

            groupZalignmentFront  = new TriangleObject[] { c1, c2, c3, c4, c5, c6, c7, c8, c9 };
            groupZalignmentMiddle = new TriangleObject[] { c10, c11, c12, c13, c14, c15, c16, c17, c18 };
            groupZalignmentBack   = new TriangleObject[] { c19, c20, c21, c22, c23, c24, c25, c26, c27 };

            sManager.addContent(group3x3x3);
            sManager.formGroup(group3x3x3);

            updateShiftTranslation(shiftOffset);
        }