コード例 #1
0
        // TODO: this parameter won't be optional
        public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
        {
            Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);

            MyBuilderInstanceData builderInstanceData;

            if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
            {
                builderInstanceData       = new MyBuilderInstanceData();
                builderInstanceData.Model = model;
                m_instanceParts.Add(model, builderInstanceData);
            }

            //if (bones == null)
            //{
            //    builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
            //    {
            //        ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
            //        EnableSkinning = false,
            //        LocalMatrix = localMatrix
            //    });
            //}
            //else
            //{
            //    var cubeInstance = new MyCubeInstanceData()
            //    {
            //        ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
            //        EnableSkinning = true,
            //        LocalMatrix = localMatrix,
            //    };

            //    cubeInstance.BoneRange = gridSize;

            //    for (int i = 0; i < 9; i++)
            //    {
            //        cubeInstance[i] = bones[i];
            //    }

            //    builderInstanceData.InstanceData.Add(cubeInstance);
            //}

            builderInstanceData.InstanceData.Add(new MyInstanceData()
            {
                ColorMaskHSV = new VRageMath.PackedVector.HalfVector4(new Vector4(MyPlayer.SelectedColor, 0)),
                LocalMatrix  = localMatrix
            });
        }
コード例 #2
0
        // TODO: this parameter won't be optional
        public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
        {
            Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);

            MyBuilderInstanceData builderInstanceData;
            if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
            {
                builderInstanceData = new MyBuilderInstanceData();
                builderInstanceData.Model = model;
                m_instanceParts.Add(model, builderInstanceData);
            }

            //if (bones == null)
            //{
            //    builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
            //    {
            //        ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
            //        EnableSkinning = false,
            //        LocalMatrix = localMatrix
            //    });
            //}
            //else
            //{
            //    var cubeInstance = new MyCubeInstanceData()
            //    {
            //        ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
            //        EnableSkinning = true,
            //        LocalMatrix = localMatrix,
            //    };

            //    cubeInstance.BoneRange = gridSize;

            //    for (int i = 0; i < 9; i++)
            //    {
            //        cubeInstance[i] = bones[i];
            //    }

            //    builderInstanceData.InstanceData.Add(cubeInstance);
            //}

            builderInstanceData.InstanceData.Add(new MyInstanceData()
            {
                ColorMaskHSV = new VRageMath.PackedVector.HalfVector4(new Vector4(MyPlayer.SelectedColor, 0)),
                LocalMatrix = localMatrix
            });
        }
コード例 #3
0
        // TODO: this parameter won't be optional
        public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
        {
            Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);

            MyBuilderInstanceData builderInstanceData;

            if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
            {
                builderInstanceData       = new MyBuilderInstanceData();
                builderInstanceData.Model = model;
                m_instanceParts.Add(model, builderInstanceData);
            }

            if (bones == null)
            {
                builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
                {
                    ColorMaskHSV   = new Vector4(MyPlayer.SelectedColor, 0),
                    EnableSkinning = false,
                    LocalMatrix    = localMatrix
                });
            }
            else
            {
                var cubeInstance = new MyCubeInstanceData()
                {
                    ColorMaskHSV   = new Vector4(MyPlayer.SelectedColor, 0),
                    EnableSkinning = true,
                    LocalMatrix    = localMatrix,
                };

                cubeInstance.BoneRange = gridSize;

                for (int i = 0; i < 9; i++)
                {
                    cubeInstance[i] = bones[i];
                }

                builderInstanceData.InstanceData.Add(cubeInstance);
            }

            m_cubeBuilderAABB = m_cubeBuilderAABB.Include(
                new BoundingBox(new Vector3(-MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)),
                                new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large))).Transform(localMatrix));
        }
コード例 #4
0
        // TODO: this parameter won't be optional
        public void AddInstance(ModelId model, MatrixD matrix, ref MatrixD invGridWorldMatrix, Vector4 colorMaskHsv = default(Vector4), Vector3UByte[] bones = null, float gridSize = 1f)
        {
            Matrix localMatrix = (Matrix)(matrix * invGridWorldMatrix);

            MyBuilderInstanceData builderInstanceData;
            if (!m_instanceParts.TryGetValue(model, out builderInstanceData))
            {
                builderInstanceData = new MyBuilderInstanceData();
                builderInstanceData.Model = model;
                m_instanceParts.Add(model, builderInstanceData);
            }

            if (bones == null)
            {
                builderInstanceData.InstanceData.Add(new MyCubeInstanceData()
                {
                    ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
                    EnableSkinning = false,
                    LocalMatrix = localMatrix
                });
            }
            else
            {
                var cubeInstance = new MyCubeInstanceData()
                {
					ColorMaskHSV = new Vector4(MyPlayer.SelectedColor, 0),
                    EnableSkinning = true,
                    LocalMatrix = localMatrix,
                };

                cubeInstance.BoneRange = gridSize;

                for (int i = 0; i < 9; i++)
                {
                    cubeInstance[i] = bones[i];
                }

                builderInstanceData.InstanceData.Add(cubeInstance);
            }

            m_cubeBuilderAABB = m_cubeBuilderAABB.Include(
                new BoundingBox(new Vector3(-MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)),
                                new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large))).Transform(localMatrix));
        }