void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { MyCharacterHitInfo charHitInfo = customdata as MyCharacterHitInfo; if (charHitInfo == null || charHitInfo.BoneIndex == -1) return; MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Position = charHitInfo.Triangle.IntersectionPointInObjectSpace; renderable.Normal = charHitInfo.Triangle.NormalInObjectSpace; renderable.RenderObjectId = Render.GetRenderObjectID(); renderable.Material = MyStringHash.GetOrCompute(m_characterDefinition.PhysicalMaterial); var decalId = decalHandler.AddDecal(ref renderable); if (decalId == null) return; AddBoneDecal(decalId.Value, charHitInfo.HitPositionBindingPose, charHitInfo.HitNormalBindingPose, charHitInfo.BoneIndex); }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Flags = MyDecalFlags.World; renderable.Position = hitInfo.Position; renderable.Normal = hitInfo.Normal; renderable.RenderObjectId = Render.GetRenderObjectID(); renderable.Material = Physics.GetMaterialAt(hitInfo.Position); decalHandler.AddDecal(ref renderable); }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { MyDecalRenderInfo renderable = new MyDecalRenderInfo(); MyCubeGridHitInfo gridHitInfo = customdata as MyCubeGridHitInfo; renderable.Flags = BlockDefinition.PhysicalMaterial.Transparent ? MyDecalFlags.Transparent : MyDecalFlags.None; if (FatBlock == null) { renderable.Position = Vector3D.Transform(hitInfo.Position, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = CubeGrid.Render.GetRenderObjectID(); } else { renderable.Position = Vector3D.Transform(hitInfo.Position, FatBlock.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, FatBlock.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = FatBlock.Render.GetRenderObjectID(); } renderable.Material = MyStringHash.GetOrCompute(BlockDefinition.PhysicalMaterial.Id.SubtypeName); if (gridHitInfo != null) { VertexBoneIndicesWeights? boneIndicesWeights = gridHitInfo.Triangle.GetAffectingBoneIndicesWeights(ref m_boneIndexWeightTmp); if (boneIndicesWeights.HasValue) { renderable.BoneIndices = boneIndicesWeights.Value.Indices; renderable.BoneWeights = boneIndicesWeights.Value.Weights; var decalId = decalHandler.AddDecal(ref renderable); if (decalId != null) CubeGrid.RenderData.AddDecal(Position, gridHitInfo, decalId.Value); return; } } decalHandler.AddDecal(ref renderable); }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { // TODO }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler, MyStringHash material) { Debug.Assert(m_mapIdToBlock.Count > 0); MyCubeGridHitInfo gridHitInfo = customdata as MyCubeGridHitInfo; if (gridHitInfo == null) { Debug.Fail("MyCubeGridHitInfo must not be null"); return; } MySlimBlock block = m_mapIdToBlock.First().Value; MyPhysicalMaterialDefinition physicalMaterial = block.BlockDefinition.PhysicalMaterial; MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Position = Vector3D.Transform(hitInfo.Position, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = CubeGrid.Render.GetRenderObjectID(); VertexBoneIndicesWeights?boneIndicesWeights = gridHitInfo.Triangle.GetAffectingBoneIndicesWeights(ref m_boneIndexWeightTmp); if (boneIndicesWeights.HasValue) { renderable.BoneIndices = boneIndicesWeights.Value.Indices; renderable.BoneWeights = boneIndicesWeights.Value.Weights; } if (material.GetHashCode() == 0) { renderable.Material = MyStringHash.GetOrCompute(physicalMaterial.Id.SubtypeName); } else { renderable.Material = material; } var decalId = decalHandler.AddDecal(ref renderable); if (decalId != null) { CubeGrid.RenderData.AddDecal(Position, gridHitInfo, decalId.Value); } }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Flags = BlockDefinition.PhysicalMaterial.Transparent ? MyDecalFlags.Transparent : MyDecalFlags.None; if (FatBlock == null) { renderable.Position = Vector3D.Transform(hitInfo.Position, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = CubeGrid.Render.GetRenderObjectID(); } else { renderable.Position = Vector3D.Transform(hitInfo.Position, FatBlock.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, FatBlock.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = FatBlock.Render.GetRenderObjectID(); } renderable.Material = MyStringHash.GetOrCompute(BlockDefinition.PhysicalMaterial.Id.SubtypeName); var decalId = decalHandler.AddDecal(ref renderable); if (decalId != null) CubeGrid.RenderData.AddDecal(Position, decalId.Value); }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { MyDecalRenderInfo info = new MyDecalRenderInfo(); info.Position = hitInfo.Position; info.Normal = hitInfo.Normal; info.RenderObjectId = -1; info.Flags = MyDecalFlags.World; info.Material = Physics.MaterialType; decalHandler.AddDecal(ref info); }
void IMyDecalProxy.AddDecals(ref MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler, MyStringHash material) { MyDecalRenderInfo renderInfo = new MyDecalRenderInfo { Position = hitInfo.Position, Normal = hitInfo.Normal, RenderObjectIds = null, Flags = MyDecalFlags.World, Source = source }; renderInfo.Material = (material.GetHashCode() != 0) ? material : base.Physics.MaterialType; decalHandler.AddDecal(ref renderInfo, null); }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler, MyStringHash material) { // TODO }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { Debug.Assert(m_mapIdToBlock.Count > 0); MySlimBlock block = m_mapIdToBlock.First().Value; MyPhysicalMaterialDefinition physicalMaterial = block.BlockDefinition.PhysicalMaterial; MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Flags = physicalMaterial.Transparent ? MyDecalFlags.Transparent : MyDecalFlags.None; renderable.Position = Vector3D.Transform(hitInfo.Position, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = CubeGrid.Render.GetRenderObjectID(); renderable.Material = MyStringHash.GetOrCompute(physicalMaterial.Id.SubtypeName); var decalId = decalHandler.AddDecal(ref renderable); if (decalId != null) { CubeGrid.RenderData.AddDecal(Position, decalId.Value); } }
void IMyDecalProxy.AddDecals(ref MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler, MyStringHash material) { MyCubeGrid.MyCubeGridHitInfo gridHitInfo = customdata as MyCubeGrid.MyCubeGridHitInfo; if (gridHitInfo != null) { MyPhysicalMaterialDefinition physicalMaterial = this.m_mapIdToBlock.First <KeyValuePair <ushort, MySlimBlock> >().Value.BlockDefinition.PhysicalMaterial; MyDecalRenderInfo renderInfo = new MyDecalRenderInfo { Position = Vector3D.Transform(hitInfo.Position, base.CubeGrid.PositionComp.WorldMatrixInvScaled), Normal = (Vector3)Vector3D.TransformNormal(hitInfo.Normal, base.CubeGrid.PositionComp.WorldMatrixInvScaled), RenderObjectIds = base.CubeGrid.Render.RenderObjectIDs, Source = source }; VertexBoneIndicesWeights?affectingBoneIndicesWeights = gridHitInfo.Triangle.GetAffectingBoneIndicesWeights(ref m_boneIndexWeightTmp); if (affectingBoneIndicesWeights != null) { renderInfo.BoneIndices = affectingBoneIndicesWeights.Value.Indices; renderInfo.BoneWeights = affectingBoneIndicesWeights.Value.Weights; } renderInfo.Material = (material.GetHashCode() != 0) ? material : MyStringHash.GetOrCompute(physicalMaterial.Id.SubtypeName); m_tmpIds.Clear(); decalHandler.AddDecal(ref renderInfo, m_tmpIds); foreach (uint num in m_tmpIds) { base.CubeGrid.RenderData.AddDecal(base.Position, gridHitInfo, num); } } }
void IMyDecalProxy.AddDecals(MyHitInfo hitInfo, MyStringHash source, object customdata, IMyDecalHandler decalHandler) { Debug.Assert(m_mapIdToBlock.Count > 0); MySlimBlock block = m_mapIdToBlock.First().Value; MyPhysicalMaterialDefinition physicalMaterial = block.BlockDefinition.PhysicalMaterial; MyDecalRenderInfo renderable = new MyDecalRenderInfo(); renderable.Flags = physicalMaterial.Transparent ? MyDecalFlags.Transparent : MyDecalFlags.None; renderable.Position = Vector3D.Transform(hitInfo.Position, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.Normal = Vector3D.TransformNormal(hitInfo.Normal, CubeGrid.PositionComp.WorldMatrixInvScaled); renderable.RenderObjectId = CubeGrid.Render.GetRenderObjectID(); renderable.Material = MyStringHash.GetOrCompute(physicalMaterial.Id.SubtypeName); var decalId = decalHandler.AddDecal(ref renderable); if (decalId != null) CubeGrid.RenderData.AddDecal(Position, decalId.Value); }