示例#1
0
        /// <summary>
        /// Ray Constructor
        /// </summary>
        public Ray() : base()
        {
            Material = new Material()
            {
                Color     = new Vector4(1, 1, 1, 1),
                Diffuse   = new Vector3(1, 1, 1),
                Specular  = new Vector3(1, 1, 1),
                Shininess = 64.0f
            };

            //Create Line
            line = new Mesh();

            line.Positions.Add(new Vector3(0));
            line.Positions.Add(new Vector3(0));

            line.Normals.Add(new Vector3(0));
            line.Normals.Add(new Vector3(0));

            line.UVs.Add(new Vector2(0));
            line.UVs.Add(new Vector2(0));

            line.Indices.Add(0);
            line.Indices.Add(1);

            Name = "Ray";

            //Add Line
            Meshes.Add(line);
        }
示例#2
0
        /// <summary>
        /// Slider
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Width"></param>
        /// <param name="Height"></param>
        /// <param name="Min"></param>
        /// <param name="Max"></param>
        /// <param name="Value"></param>
        /// <param name="Color"></param>
        /// <param name="CursorColor"></param>
        public Slider(GUI gui, float X, float Y, float Width, float Height, float Min, float Max, float Value, Vector4 Color, Vector4 CursorColor) : base(gui)
        {
            this.X      = X;
            this.Width  = Width;
            this.Height = Height - 8;
            this.Y      = Y + 4;
            if (this.Height < 4)
            {
                this.Height = Height;
            }

            this.Color = Color;

            this.Min   = Min;
            this.Max   = Max;
            this.Value = Value;

            Cursor            = new Box(gui, X, Y, 8, Height, CursorColor);
            Cursor.MouseMoveX = true;
            Children.Add(Cursor);

            //Set cursor position
            Cursor.X = (((Value - Min) / (Max - Min)) * (Width - Cursor.Width)) + X;

            Meshes.Add(Quad.Rect().Compile());
            Update();

            MultiShader_StrVal = GUI.Default_Element;
        }
示例#3
0
        public void ReadA(Stream s)
        {
            asciiReader = new StreamReader(s);

            Meshes.Add(new MeshBuilder(true, true));
            Materials.Add(MaterialHelper.CreateMaterial(Brushes.Blue));

            while (!asciiReader.EndOfStream)
            {
                var line = asciiReader.ReadLine().Trim();
                if (line.Length == 0 || line.StartsWith("\0") || line.StartsWith("#") || line.StartsWith("!") || line.StartsWith("$"))
                {
                    continue;
                }
                string id, values;
                SplitLine(line, out id, out values);
                switch (id)
                {
                case "solid":
                    break;

                case "facet":
                    ReadTriangleA(values);
                    break;

                case "endsolid":
                    break;
                }
            }
            asciiReader.Close();
        }
示例#4
0
        private void SetFirstLine(string line)
        {
            string[] xvalues = line.Split();

            //ID = xvalues[0];
            Name       = xvalues[1].Replace('_', ' ');
            PluralName = xvalues[2].Replace('_', ' ');

            int tmp = int.Parse(xvalues[3]);//meshCount

            for (int i = 0; i < tmp; i++)
            {
                Meshes.Add(new Variable(xvalues[4 + (i * 2)], ulong.Parse(xvalues[5 + (i * 2)])));
            }

            tmp *= 2;

            SpecialValues[0] = xvalues[tmp + 4];
            SpecialValues[1] = xvalues[tmp + 5];
            Price            = int.Parse(xvalues[tmp + 6]);
            SpecialValues[2] = xvalues[tmp + 7];
            Weight           = double.Parse(xvalues[tmp + 8], CultureInfo.InvariantCulture);

            for (int i = 0; i < ItemStats.Length; i++)
            {
                ItemStats[i] = int.Parse(xvalues[i + tmp + 9]);
            }
        }
示例#5
0
文件: Model.cs 项目: CriDos/xenko
 /// <summary>
 /// Adds the specified mesh (for collection Initializers).
 /// </summary>
 /// <param name="mesh">The mesh.</param>
 public void Add(Mesh mesh)
 {
     if (mesh != null)
     {
         Meshes.Add(mesh);
     }
 }
示例#6
0
            public void BuildModel(int modelIndex)
            {
                _srModel = _srFile.Models[modelIndex];
                String modelName = _objectName + "-" + modelIndex.ToString();

                #region Materials
                ProgressStage = "Model " + modelIndex.ToString() + " - Creating Materials";
                Thread.Sleep(500);
                for (int materialIndex = 0; materialIndex < _srModel.MaterialCount; materialIndex++)
                {
                    Material material     = new Material();
                    Color    colorDiffuse = Color.FromArgb((int)unchecked (_srModel.Materials[materialIndex].colour));
                    material.Diffuse         = colorDiffuse;
                    material.TextureFileName = GetTextureName(_srModel, materialIndex);
                    Materials.Add(material);

                    progressLevel += _srModel.IndexCount / _srModel.Groups.Length;
                }
                #endregion

                #region Groups
                for (int groupIndex = 0; groupIndex < _srModel.Groups.Length; groupIndex++)
                {
                    ProgressStage = "Model " + modelIndex.ToString() + " - Creating Group " + groupIndex.ToString();
                    Thread.Sleep(100);

                    Tree   srGroup   = _srModel.Groups[groupIndex];
                    String groupName = String.Format("{0}-{1}-group-{2}", _objectName, modelIndex, groupIndex);
                    if (srGroup != null && srGroup.mesh != null &&
                        srGroup.mesh.indexCount > 0 && srGroup.mesh.polygonCount > 0)
                    {
                        Node         group      = new Node();
                        SRMeshParser meshParser = new SRMeshParser(_objectName, _srFile);
                        meshParser.BuildMesh(modelIndex, groupIndex, 0);
                        foreach (SubMesh subMesh in meshParser.SubMeshes)
                        {
                            // If the mesh parser knew the total submeshes for the model,
                            // then this could be done inside BuildMesh.
                            subMesh.MeshIndex = Meshes.Count;
                            group.SubMeshIndices.Add(SubMeshes.Count);
                            SubMeshes.Add(subMesh);
                        }
                        Meshes.Add(meshParser.Mesh);
                        group.Name = groupName;
                        Groups.Add(group);
                    }
                }
                #endregion

                ModelName = modelName;

                if (_srFile.Asset == CDC.Asset.Unit)
                {
                    Model = new Unit(this);
                }
                else
                {
                    Model = new Physical(this);
                }
            }
示例#7
0
        protected virtual async Task LoadGeometryAsync(IAwaitCaller awaitCaller, Func <string, IDisposable> MeasureTime)
        {
            var inverter = InvertAxis.Create();

            var meshImporter = new MeshImporter();

            for (int i = 0; i < GLTF.meshes.Count; ++i)
            {
                var index = i;
                using (MeasureTime("ReadMesh"))
                {
                    var x = meshImporter.ReadMesh(GLTF, index, inverter);
                    var y = await BuildMeshAsync(awaitCaller, MeasureTime, x, index);

                    Meshes.Add(y);
                }
            }

            using (MeasureTime("LoadNodes"))
            {
                for (int i = 0; i < GLTF.nodes.Count; i++)
                {
                    Nodes.Add(NodeImporter.ImportNode(GLTF.nodes[i], i).transform);
                }
            }
            await awaitCaller.NextFrame();

            using (MeasureTime("BuildHierarchy"))
            {
                var nodes = new List <NodeImporter.TransformWithSkin>();
                for (int i = 0; i < Nodes.Count; ++i)
                {
                    nodes.Add(NodeImporter.BuildHierarchy(GLTF, i, Nodes, Meshes));
                }

                NodeImporter.FixCoordinate(GLTF, nodes, inverter);

                // skinning
                for (int i = 0; i < nodes.Count; ++i)
                {
                    NodeImporter.SetupSkinning(GLTF, nodes, i, inverter);
                }

                if (Root == null)
                {
                    Root = new GameObject("GLTF");
                }
                if (GLTF.rootnodes != null)
                {
                    // connect root
                    foreach (var x in GLTF.rootnodes)
                    {
                        var t = nodes[x].Transform;
                        t.SetParent(Root.transform, false);
                    }
                }
            }
            await awaitCaller.NextFrame();
        }
示例#8
0
 public void CreateMesh(Canvas canvas)
 {
     if (PointsToAdd.Count == 4 && TexturePath != null)
     {
         Meshes.Add(new Mesh(openGL, MeshName, SelectedMeshType, new List <Point>(PointsToAdd), new Transformation(), TexturePath));
         i = -1;
     }
 }
示例#9
0
        public Model(MeshVertex[] vertices, uint[] indices = null, MeshMaterial material = default, Matrix4 state = default, string name = "", RenderFlags renderFlags = RenderFlags.Solid)
        {
            Meshes.Add(new Mesh(name, vertices, indices ?? new uint[0], new MeshTexture[0], material));  // TODO: perhaps replace empty array with nulls?

            State = state == default ? Matrix4.Identity : state;

            RenderFlags = renderFlags;
        }
示例#10
0
文件: BodyPart.cs 项目: xbloke/sledge
 public void AddMesh(int groupId, Mesh mesh)
 {
     if (!Meshes.ContainsKey(groupId))
     {
         Meshes.Add(groupId, new List <Mesh>());
     }
     Meshes[groupId].Add(mesh);
 }
示例#11
0
        protected virtual Schedulable <Unit> LoadAsync()
        {
            return
                (Schedulable.Create()
                 .AddTask(Scheduler.ThreadPool, () =>
            {
                m_materialFactory.Prepare(GLTF);
            })
                 .ContinueWithCoroutine(Scheduler.ThreadPool, () => m_materialFactory.TexturesProcessOnAnyThread(GLTF, Storage))
                 .ContinueWithCoroutine(Scheduler.MainThread, () => m_materialFactory.TexturesProcessOnMainThread(GLTF))
                 .ContinueWithCoroutine(Scheduler.MainThread, () => m_materialFactory.LoadMaterials(GLTF))
                 .OnExecute(Scheduler.ThreadPool, parent =>
            {
                // UniGLTF does not support draco
                // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md#conformance
                if (GLTF.extensionsRequired.Contains("KHR_draco_mesh_compression"))
                {
                    throw new UniGLTFNotSupportedException("draco is not supported");
                }

                // meshes
                var meshImporter = new MeshImporter();
                for (int i = 0; i < GLTF.meshes.Count; ++i)
                {
                    var index = i;
                    parent.AddTask(Scheduler.ThreadPool,
                                   () =>
                    {
                        using (MeasureTime("ReadMesh"))
                        {
                            return meshImporter.ReadMesh(this, index);
                        }
                    })
                    .ContinueWithCoroutine <MeshWithMaterials>(Scheduler.MainThread, x => BuildMesh(x, index))
                    .ContinueWith(Scheduler.ThreadPool, x => Meshes.Add(x))
                    ;
                }
            })
                 .ContinueWithCoroutine(Scheduler.MainThread, LoadNodes)
                 .ContinueWithCoroutine(Scheduler.MainThread, BuildHierarchy)
                 .ContinueWith(Scheduler.MainThread, _ =>
            {
                using (MeasureTime("AnimationImporter"))
                {
                    AnimationImporter.Import(this);
                }
            })
                 .ContinueWithCoroutine(Scheduler.MainThread, OnLoadModel)
                 .ContinueWith(Scheduler.CurrentThread,
                               _ =>
            {
                if (m_showSpeedLog)
                {
                    Debug.Log(GetSpeedLog());
                }
                return Unit.Default;
            }));
        }
        internal void Read(EndianBinaryReader reader, ObjectSection section = null)
        {
            uint signature = reader.ReadUInt32();

            reader.SeekCurrent(4);   // Unused flags

            int  meshCount, materialCount;
            long meshesOffset, materialsOffset;

            // X stores mesh/material count before the bounding sphere
            if (section?.Format == BinaryFormat.X)
            {
                meshCount       = reader.ReadInt32();
                materialCount   = reader.ReadInt32();
                BoundingSphere  = reader.ReadBoundingSphere();
                meshesOffset    = reader.ReadOffset();
                materialsOffset = reader.ReadOffset();

                reader.SkipNulls(4 * sizeof(uint));
                Flags = reader.ReadUInt32(); // TODO: Is this available in other games?
                reader.SkipNulls(sizeof(uint));
            }

            else
            {
                BoundingSphere  = reader.ReadBoundingSphere();
                meshCount       = reader.ReadInt32();
                meshesOffset    = reader.ReadOffset();
                materialCount   = reader.ReadInt32();
                materialsOffset = reader.ReadOffset();
            }

            reader.SkipNulls(10 * sizeof(uint));

            Meshes.Capacity = meshCount;

            for (int i = 0; i < meshCount; i++)
            {
                reader.ReadAtOffset(meshesOffset + i * Mesh.GetByteSize(section?.Format ?? BinaryFormat.DT), () =>
                {
                    var mesh = new Mesh();
                    mesh.Read(reader, section);
                    Meshes.Add(mesh);
                });
            }

            Materials.Capacity = materialCount;

            for (int i = 0; i < materialCount; i++)
            {
                reader.ReadAtOffset(materialsOffset + i * Material.BYTE_SIZE, () =>
                {
                    var material = new Material();
                    material.Read(reader);
                    Materials.Add(material);
                });
            }
        }
示例#13
0
 private ObjMesh NewMesh(string name)
 {
     Meshes.Add(CurrentMesh = new ObjMesh(this)
     {
         Name = name
     });
     CurrentSubMesh = null;
     return(CurrentMesh);
 }
示例#14
0
 /// <summary>This allows you to add a mesh to the seam fixer.
 /// NOTE: You must later call <b>Generate</b> to seam fix the added meshes.</summary>
 public void AddMesh(Mesh mesh)
 {
     if (mesh != null)
     {
         Meshes.Add(new Pair()
         {
             Source = mesh
         });
     }
 }
        public SkeletalModel(string name, string file, Skeleton skeleton, List <Mesh> meshes)
            : base(name, file, meshes, "Skeletal")
        {
            Skeleton = skeleton;
            AddPose(skeleton.BindPose.Clone("Default"));

            shaderProgram.AddUniform("Bones");

            Meshes.Add(Util.Mesh.GenerateSkeletonMesh(skeleton));
        }
示例#16
0
 public Particle(Particle bp)
 {
     Name = "ParticleNode";
     Meshes.Add(bp.Meshes[0]);
     W     = bp.W;
     H     = bp.H;
     Alpha = bp.Alpha;
     Life  = bp.Life;
     Tex   = bp.Tex;
 }
示例#17
0
        public bool ParseJsonElement(JsonElement element)
        {
            // NumMesh
            JsonElement numMeshElem;

            if (element.TryGetProperty("NumMesh", out numMeshElem))
            {
                if (numMeshElem.ValueKind == JsonValueKind.Number)
                {
                    NumMesh = numMeshElem.GetUInt32();
                }
            }
            // NumMaterial
            JsonElement numMaterialElem;

            if (element.TryGetProperty("NumMaterial", out numMaterialElem))
            {
                if (numMaterialElem.ValueKind == JsonValueKind.Number)
                {
                    NumMaterial = numMaterialElem.GetUInt32();
                }
            }
            // Mesh
            JsonElement meshElem;

            if (element.TryGetProperty("Mesh", out meshElem))
            {
                if (meshElem.ValueKind == JsonValueKind.Array)
                {
                    for (int i = 0; i < meshElem.GetArrayLength(); ++i)
                    {
                        var mesh = new MeshData();
                        mesh.ParseJsonElement(meshElem[i]);
                        Meshes.Add(mesh);
                    }
                }
            }
            // Material
            JsonElement materialElem;

            if (element.TryGetProperty("Material", out materialElem))
            {
                if (materialElem.ValueKind == JsonValueKind.Array)
                {
                    for (int i = 0; i < materialElem.GetArrayLength(); ++i)
                    {
                        var material = new MaterialData();
                        material.ParseJsonElement(materialElem[i]);
                        Materials.Add(material);
                    }
                }
            }

            return(true);
        }
示例#18
0
        /// <summary>
        /// Loads a md5mesh file
        /// </summary>
        /// <param name="filename">File name to load</param>
        /// <returns>True if successful</returns>
        public bool Load(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return(false);
            }

            if (!File.Exists(filename))
            {
                return(false);
            }

            int numjoints = 0;
            int nummeshes = 0;

            using (StreamReader stream = new StreamReader(filename))
            {
                string line = null;
                while ((line = stream.ReadLine()) != null)
                {
                    if (line.StartsWith("MD5Version"))
                    {
                        if (Version != int.Parse(line.Substring("MD5Version".Length)))
                        {
                            Trace.WriteLine("Unsuported MD5Mesh found !");
                            return(false);
                        }
                    }
                    else if (line.StartsWith("numJoints"))
                    {
                        numjoints = int.Parse(line.Substring("numJoints".Length));
                        Joints    = new Joint[numjoints];
                    }
                    else if (line.StartsWith("numMeshes"))
                    {
                        nummeshes = int.Parse(line.Substring("numMeshes".Length));
                        Meshes    = new List <SubMesh>(nummeshes);
                    }
                    else if (line.StartsWith("joints"))
                    {
                        ReadJoints(stream);
                    }
                    else if (line.StartsWith("mesh"))
                    {
                        SubMesh mesh = new SubMesh();
                        mesh.ReadMesh(stream);
                        Meshes.Add(mesh);
                    }
                }
            }

            Prepare();

            return(true);
        }
示例#19
0
        public void Rebuild(GraphicsDevice gd, bool force = false)
        {
            switch (MeshType)
            {
            case MeshType.Smooth:
                Meshes = new List <HexMapMesh> {
                    new HexMapMeshSmooth(gd, Hexes, Texture)
                };
                break;

            case MeshType.Flat:
                if (force)
                {
                    Meshes = new List <HexMapMesh>();
                    for (var xp = 0; xp < Width; xp += PatchSize)
                    {
                        for (var yp = 0; yp < Height; yp += PatchSize)
                        {
                            var patchHexes = new List <Hexagon>();
                            for (var x = xp; x < xp + PatchSize; x++)
                            {
                                for (var y = yp; y < yp + PatchSize; y++)
                                {
                                    var hex = GetHex(x, y);
                                    if (hex != null)
                                    {
                                        patchHexes.Add(hex);
                                    }
                                }
                            }
                            Meshes.Add(new HexMapMeshFlat(gd, patchHexes, Texture));
                        }
                    }
                }
                else
                {
                    foreach (var dirtyPatch in DirtyPatches)
                    {
                        var mesh = Meshes.FirstOrDefault(m => m.PatchID == dirtyPatch);
                        if (mesh == null)
                        {
                            continue;
                        }
                        Meshes.Remove(mesh);
                        Meshes.Add(new HexMapMeshFlat(gd, mesh.Hexes, Texture));
                    }
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            DirtyPatches.Clear();
        }
示例#20
0
        public void BuildModel(RenderResource resource, int modelIndex, CDC.Objects.ExportOptions options)
        {
            _srModel = _srFile.Models[modelIndex];
            String modelName = _objectName + "-" + modelIndex.ToString();

            #region Materials

            for (int materialIndex = 0; materialIndex < _srModel.MaterialCount; materialIndex++)
            {
                Material material = new Material();
                material.Visible = _srModel.Materials[materialIndex].visible;
                // Breaks early SR1 builds.
                //material.BlendMode = _srModel.Materials[materialIndex].blendMode;
                //int sortPush = unchecked((sbyte)_srModel.Materials[materialIndex].sortPush);
                //sortPush = 128 - sortPush;
                //material.DepthBias = (1.0f / 100000.0f) * sortPush;
                // Maybe use a hack for warpgates WARPGATE_DrawWarpGateRim indicates tree 3 should have lower priority.
                Color colorDiffuse = Color.FromArgb((int)unchecked (_srModel.Materials[materialIndex].colour));
                material.Diffuse         = colorDiffuse;
                material.TextureFileName = CDC.Objects.Models.SRModel.GetTextureName(_srModel, materialIndex, options);
                Materials.Add(material);
            }

            #endregion

            #region Groups
            for (int groupIndex = 0; groupIndex < _srModel.Groups.Length; groupIndex++)
            {
                Tree   srGroup   = _srModel.Groups[groupIndex];
                String groupName = String.Format("{0}-{1}-group-{2}", _objectName, modelIndex, groupIndex);
                if (srGroup != null && srGroup.mesh != null &&
                    srGroup.mesh.indexCount > 0 && srGroup.mesh.polygonCount > 0)
                {
                    ModelNode    group      = new ModelNode();
                    SRMeshParser meshParser = new SRMeshParser(_objectName, _srFile);
                    meshParser.BuildMesh(resource, modelIndex, groupIndex, 0);
                    foreach (SubMesh subMesh in meshParser.SubMeshes)
                    {
                        // If the mesh parser knew the total submeshes for the model,
                        // then this could be done inside BuildMesh.
                        subMesh.MeshIndex = Meshes.Count;
                        group.SubMeshIndices.Add(SubMeshes.Count);
                        SubMeshes.Add(subMesh);
                    }
                    Meshes.Add(meshParser.Mesh);
                    group.Name = groupName;
                    Groups.Add(group);
                }
            }
            #endregion

            ModelName = modelName;
            Model     = new Model(this);
        }
        /// <summary>
        /// Initialization
        /// </summary>
        /// <param name="device"></param>
        /// <param name="physicsEngine"></param>
        public override void Initialize(xnagrfx.GraphicsDevice device, PhysicsEngine physicsEngine)
        {
            try
            {
                InitError = string.Empty;
                // set flag so rendering engine renders us last
                Flags |= VisualEntityProperties.UsesAlphaBlending;

                // creates effect, loads meshes, etc
                base.Initialize(device, physicsEngine);

                HeightFieldShapeProperties hf = new HeightFieldShapeProperties("height field", 2, 0.02f, 2, 0.02f, 0, 0, 1, 1);
                hf.HeightSamples = new HeightFieldSample[hf.RowCount * hf.ColumnCount];
                for (int i = 0; i < hf.HeightSamples.Length; i++)
                {
                    hf.HeightSamples[i] = new HeightFieldSample();
                }

                _particlePlane            = new Shape(hf);
                _particlePlane.State.Name = "sonar impact plane";

                VisualEntityMesh sonarMesh = null;

                // we render on our own only the laser impact points. The laser Box is rendered as part of the parent.
                int index = Meshes.Count;
                Meshes.Add(SimulationEngine.ResourceCache.CreateMesh(device, _particlePlane.State));
                Meshes[0].Textures[0] = SimulationEngine.ResourceCache.CreateTextureFromFile(device, "particle.bmp");

                // we have a custom effect, with an additional global parameter. Get handle to it here
                if (Effect != null)
                {
                    _timeAttenuationHandle = Effect.GetParameter("timeAttenuation");
                }

                World = xna.Matrix.Identity;
                if (Meshes.Count > 1)
                {
                    sonarMesh = Meshes[0];
                }

                if (Parent == null)
                {
                    throw new Exception("This entity must be a child of another entity.");
                }

                Parent.AddShapeToPhysicsEntity(_sonarBox, sonarMesh);
            }
            catch (Exception ex)
            {
                HasBeenInitialized = false;
                InitError          = ex.ToString();
            }
        }
示例#22
0
        public void ConvertLegacy()
        {
            if (source != null)
            {
                Meshes.Add(new Pair()
                {
                    Source = mesh, Output = mesh
                });

                source = null;
                mesh   = null;
            }
        }
示例#23
0
        public int AddMesh(DMesh3 mesh, PrintMeshOptions options)
        {
            SliceMesh m = new SliceMesh()
            {
                mesh    = mesh,
                bounds  = mesh.CachedBounds,
                options = options
            };
            int idx = Meshes.Count;

            Meshes.Add(m);
            return(idx);
        }
示例#24
0
        public void Read(BlamCacheFile cacheFile, Resource resourceRef)
        {
            IReader         reader     = cacheFile.Reader;
            StructureLayout meshLayout = cacheFile.GetLayout("model section");

            for (int i = 0; i < Meshes.Capacity; i++)
            {
                reader.SeekTo(meshTableOffset + (i * meshLayout.Size));
                Meshes.Add(new BlamModelMesh(cacheFile, i, meshLayout));
            }

            ReadResourceBuffers(cacheFile, ref resourceRef);
        }
示例#25
0
        /// <summary>
        /// Box Constructor
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Width"></param>
        /// <param name="Height"></param>
        /// <param name="Color"></param>
        public Box(GUI gui, float X, float Y, float Width, float Height, Vector4 Color) : base(gui)
        {
            this.X      = X;
            this.Y      = Y;
            this.Width  = Width;
            this.Height = Height;
            this.Color  = Color;

            Meshes.Add(Quad.Rect().Compile());
            Update();

            MultiShader_StrVal = GUI.Default_Element;
        }
示例#26
0
        void InitFrames(xxFrame frame)
        {
            Frames.Add(frame);

            if (frame.Mesh != null)
            {
                Meshes.Add(frame);
            }

            for (int i = 0; i < frame.Count; i++)
            {
                InitFrames(frame[i]);
            }
        }
示例#27
0
        private void ProcessNode(Node node, Scene scene)
        {
            // process all the node's meshes (if any)
            for (int i = 0; i < node.MeshCount; i++)
            {
                Assimp.Mesh mesh = scene.Meshes[node.MeshIndices[i]];
                Meshes.Add(ProcessMesh(mesh, scene));
            }

            // then do the same for each of its children
            for (int i = 0; i < node.ChildCount; i++)
            {
                ProcessNode(node.Children[i], scene);
            }
        }
示例#28
0
        private void Initialize()
        {
            if (Meshes == null)
            {
                Meshes = new Dictionary <int, Record>();
            }
            if (Mesh == null)
            {
                Mesh = new List <Record>();
            }

            foreach (var item in Mesh)
            {
                Meshes.Add(item.GetHashCode(), item);
            }
        }
示例#29
0
        protected override void ReadMesh()
        {
            // Override internal mesh read method to fill the mesh list
            // with drawable meshes
            DrawableRoRsmMesh m = new DrawableRoRsmMesh(Reader, Version);

            if (m.IsValid == true)
            {
                m.SetUpVertices(mDevice);
                Meshes.Add(m);
            }
            else
            {
                // TODO: debug in valid meshes
            }
        }
示例#30
0
        /// <summary>
        /// Button Constructor
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Width"></param>
        /// <param name="Height"></param>
        /// <param name="Color"></param>
        /// <param name="Text"></param>
        /// <param name="Font"></param>
        /// <param name="LineSpacing"></param>
        /// <param name="xOffset"></param>
        /// <param name="yOffset"></param>
        public Button(GUI gui, float X, float Y, float Width, float Height, Vector4 Color, string Text, Font Font, float LineSpacing = 1, float xOffset = 0, float yOffset = 0) : base(gui)
        {
            this.X      = X;
            this.Y      = Y;
            this.Width  = Width;
            this.Height = Height;
            this.Color  = Color;

            Meshes.Add(Quad.Rect().Compile());
            Update();

            //Text
            this.Text = new Text(gui, X, Y, new Vector4(1), Text, Font, Width, LineSpacing, xOffset, yOffset);
            Children.Add(this.Text);

            MultiShader_StrVal = GUI.Default_Element;
        }