Beispiel #1
0
        public WTransformGizmo(WWorld parentWorld)
        {
            m_world = parentWorld;

            SetMode(FTransformMode.Translation);
            SetTransformSpace(FTransformSpace.World);

            string[][] meshNames = new string[][]
            {
                new string[] { "TranslateCenter", "TranslateX", "TranslateY", "TranslateZ", "TranslateLinesXY", "TranslateLinesXZ", "TranslateLinesYZ" },
                new string[] { "RotateX", "RotateY", "RotateZ" },
                new string[] { "ScaleCenter", "ScaleX", "ScaleY", "ScaleZ", "ScaleLinesXY", "ScaleLinesXZ", "ScaleLinesYZ" }
            };

            m_gizmoMeshes = new SimpleObjRenderer[meshNames.Length][];
            for (int i = 0; i < m_gizmoMeshes.Length; i++)
            {
                m_gizmoMeshes[i] = new SimpleObjRenderer[meshNames[i].Length];

                for (int j = 0; j < m_gizmoMeshes[i].Length; j++)
                {
                    Obj obj = new Obj();
                    obj.Load("resources/editor/" + meshNames[i][j] + ".obj");
                    m_gizmoMeshes[i][j] = new SimpleObjRenderer(obj, new OpenTK.Vector4(1, 1, 1, 0.50f));
                    m_gizmoMeshes[i][j].FaceCullingEnabled = false;
                    m_gizmoMeshes[i][j].BlendingEnabled    = true;
                }
            }
        }
        public WViewportOrientationWidget()
        {
            string[] meshNames = new string[] { "TranslateCenter", "TranslateX", "TranslateY", "TranslateZ" };

            m_gizmoMeshes = new SimpleObjRenderer[meshNames.Length];
            for (int i = 0; i < m_gizmoMeshes.Length; i++)
            {
                Obj obj = new Obj();
                obj.Load("resources/editor/" + meshNames[i] + ".obj");
                m_gizmoMeshes[i] = new SimpleObjRenderer(obj, new OpenTK.Vector4(1, 1, 1, 1));
            }
        }
Beispiel #3
0
        public static SimpleObjRenderer LoadObjResource(string filePath)
        {
            var existRef = m_objList.Find(x => string.Compare(x.FilePath, filePath, StringComparison.InvariantCultureIgnoreCase) == 0);

            if (existRef == null)
            {
                Obj obj = new Obj();
                obj.Load(filePath);

                existRef          = new TSharedRef <SimpleObjRenderer>();
                existRef.FilePath = filePath;
                existRef.Asset    = new SimpleObjRenderer(obj);

                m_objList.Add(existRef);
            }

            existRef.ReferenceCount++;
            return(existRef.Asset);
        }
        public static SimpleObjRenderer LoadObjResource(string filePath, Vector4 tint_color, bool enable_blending = false)
        {
            var existRef = m_objList.Find(x => string.Compare(x.FilePath, filePath, StringComparison.InvariantCultureIgnoreCase) == 0 &&
                                          x.Asset.BlendingEnabled == enable_blending && x.Asset.TintColor == tint_color);

            if (existRef == null)
            {
                Obj obj = new Obj();
                obj.Load(filePath);

                existRef          = new TSharedRef <SimpleObjRenderer>();
                existRef.FilePath = filePath;
                existRef.Asset    = new SimpleObjRenderer(obj, tint_color, enable_blending);

                m_objList.Add(existRef);
            }

            existRef.ReferenceCount++;
            return(existRef.Asset);
        }