public void Add(MatrixD worldMatrix, BoundingBox box, Vector4I id, MyVoxelBase voxel) { if (m_list.Count > 1900) m_list.ClearList(); voxel = voxel.RootVoxel; box.Translate(-voxel.SizeInMetresHalf); //box.Translate(voxel.StorageMin); m_list.Add(new PredictionInfo { Id = id, Bounds = MyOrientedBoundingBoxD.Create((BoundingBoxD)box, voxel.WorldMatrix), Body = voxel }); }
public bool ExportData(string tagName, Vector4I[] vctArr) { if (vctArr == null) return true; WriteTag(tagName); m_writer.Write(vctArr.Length); foreach (var vctVal in vctArr) { WriteVector(vctVal); } return true; }
/// <summary> /// WriteVector4 /// </summary> /// <param name="vct"></param> private void WriteVector(Vector4I vct) { m_writer.Write(vct.X); m_writer.Write(vct.Y); m_writer.Write(vct.Z); m_writer.Write(vct.W); }
public void TileSizeMarginUniform(Vector4I val) { SetUniform4(base[Uniforms.tileSizeMargin], val); }
// keep this arround, maybe I should add it there instead? private string FormatWorkTracked(Vector4I workStats) { return String.Format("{0:D3}/{1:D3}/{2:D3}/{3:D3}", workStats.X, workStats.Y, workStats.Z, workStats.W); }
/// <summary> /// ExportData /// </summary> /// <param name="writer"></param> /// <param name="tagName"></param> /// <param name="vectorArray"></param> /// <returns></returns> private static bool ExportData(this BinaryWriter writer, string tagName, Vector4I[] vectorArray) { if (vectorArray == null) return true; WriteTag(writer, tagName); writer.Write(vectorArray.Length); foreach (var vectorVal in vectorArray) { var vector = vectorVal; WriteVector4I(writer, ref vector); } return true; }
/// <summary> /// WriteVector4I /// </summary> /// <param name="writer"></param> /// <param name="vector"></param> private static void WriteVector4I(this BinaryWriter writer, ref Vector4I vector) { writer.Write(vector.X); writer.Write(vector.Y); writer.Write(vector.Z); writer.Write(vector.W); }
public Vector4I[] CreateTextureIndices(List<MyRuntimeSectionInfo> sectionInfos, List<int> indices, int verticesNum) { Vector4I defaultArrayTexIndex = new Vector4I(DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX); Vector4I[] texIndices = new Vector4I[verticesNum]; for (int i = 0; i < verticesNum; i++) texIndices[i] = defaultArrayTexIndex; if (!MyRenderProxy.Settings.UseGeometryArrayTextures) // system is disabled return texIndices; foreach (MyRuntimeSectionInfo sectionInfo in sectionInfos) { MyMeshMaterialId material = MyMeshMaterials1.GetMaterialId(sectionInfo.MaterialName); MyRenderProxy.Assert(material != MyMeshMaterialId.NULL); if (!material.Info.GeometryTextureRef.IsUsed) continue; Vector4I materialTexIndex = material.Info.GeometryTextureRef.TextureSliceIndices; for (int i = 0; i < sectionInfo.TriCount*3; i++) { int index = indices[i + sectionInfo.IndexStart]; Vector4I prevTexIndex = texIndices[index]; MyRenderProxy.Assert(defaultArrayTexIndex.CompareTo(prevTexIndex) == 0 || materialTexIndex.CompareTo(prevTexIndex) == 0, "Vertex is used with different material!"); texIndices[index] = materialTexIndex; } } return texIndices; }
public Vector4I[] CreateTextureIndices(List<MyMeshPartInfo> partInfos, int verticesNum, string contentPath) { Vector4I[] indices = new Vector4I[verticesNum]; for (int i = 0; i < verticesNum; i++) indices[i] = new Vector4I(DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX); if (!MyRenderProxy.Settings.UseGeometryArrayTextures) // system is disabled return indices; foreach (MyMeshPartInfo partInfo in partInfos) { MyMaterialDescriptor materialDesc = partInfo.m_MaterialDesc; if (materialDesc == null) continue; string cmTexture, ngTexture, extTexture, alphamaskTexture; if (!materialDesc.Textures.TryGetValue("ColorMetalTexture", out cmTexture)) continue; if (!materialDesc.Textures.TryGetValue("NormalGlossTexture", out ngTexture)) continue; materialDesc.Textures.TryGetValue("AddMapsTexture", out extTexture); materialDesc.Textures.TryGetValue("AlphamaskTexture", out alphamaskTexture); cmTexture = MyResourceUtils.GetTextureFullPath(cmTexture, contentPath); ngTexture = MyResourceUtils.GetTextureFullPath(ngTexture, contentPath); extTexture = MyResourceUtils.GetTextureFullPath(extTexture, contentPath); alphamaskTexture = MyResourceUtils.GetTextureFullPath(alphamaskTexture, contentPath); Vector4I textureIndices = GetTextureIndices(cmTexture, ngTexture, extTexture, alphamaskTexture); foreach (var offset in partInfo.m_indices) { indices[offset] = textureIndices; } } return indices; }