/// <summary> /// Checks the normal map. /// </summary> /// <param name="texture">The texture.</param> private static void CheckTexture(MyTexture texture) { System.Diagnostics.Debug.Assert(texture != null, "Voxel texture missing"); MyUtils.AssertTexture((MyTexture2D)texture); texture.TextureLoaded -= CheckTexture; }
public static void LoadContent() { MyMwcLog.WriteLine("MyDecals.LoadContent() - START"); MyMwcLog.IncreaseIndent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyDecals::LoadContent"); // Reason is that if count of neighbour triangles is more then decal triangles buffer, we won't be able to add any triangleVertexes to the buffer. MyCommonDebugUtils.AssertRelease(MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER > MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES); MyCommonDebugUtils.AssertRelease(MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_LARGE <= MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER); MyCommonDebugUtils.AssertRelease(MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER_SMALL <= MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER); // Reason is that if count of neighbour triangles is more then decal triangles buffer, we won't be able to add any triangleVertexes to the buffer. MyCommonDebugUtils.AssertRelease(MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER > MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES); // Reason is that if count of neighbour triangles is more then this fade limit, we won't be able to add decals that lay on more triangles, because buffer will be never released to us. MyCommonDebugUtils.AssertRelease(MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES < (MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER * MyDecalsConstants.TEXTURE_LARGE_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT)); // Reason is that if count of neighbour triangles is more then this fade limit, we won't be able to add decals that lay on more triangles, because buffer will be never released to us. MyCommonDebugUtils.AssertRelease(MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES < (MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER * MyDecalsConstants.TEXTURE_SMALL_FADING_OUT_MINIMAL_TRIANGLE_COUNT_PERCENT)); // Large must be bigger than small MyCommonDebugUtils.AssertRelease(MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES > MyDecalsConstants.TEXTURE_SMALL_MAX_NEIGHBOUR_TRIANGLES); m_vertices = new MyVertexFormatDecal[MyDecalsConstants.MAX_DECAL_TRIANGLES_IN_BUFFER * MyDecalsConstants.VERTEXES_PER_DECAL]; m_neighbourTriangles = new List <MyTriangle_Vertex_Normals>(MyDecalsConstants.TEXTURE_LARGE_MAX_NEIGHBOUR_TRIANGLES); m_decalsForModels = new MyDecalsForPhysObjects(MyDecalsConstants.DECAL_BUFFERS_COUNT); m_decalsForVoxels = new MyDecalsForVoxels(MyDecalsConstants.DECAL_BUFFERS_COUNT); // Decal textures int texturesCount = MyEnumsToStrings.Decals.Length; m_texturesDiffuse = new MyTexture2D[texturesCount]; m_texturesNormalMap = new MyTexture2D[texturesCount]; for (int i = 0; i < texturesCount; i++) { MyMwcLog.WriteLine("textureManager " + i.ToString() + "Textures\\Decals\\" + MyEnumsToStrings.Decals[i] + "_Diffuse", SysUtils.LoggingOptions.MISC_RENDER_ASSETS); m_texturesDiffuse[i] = MyTextureManager.GetTexture <MyTexture2D>("Textures\\Decals\\" + MyEnumsToStrings.Decals[i] + "_Diffuse", null, LoadingMode.Immediate); MyMwcLog.WriteLine("textureManager " + i.ToString() + "Textures\\Decals\\" + MyEnumsToStrings.Decals[i] + "_NormalMap", SysUtils.LoggingOptions.MISC_RENDER_ASSETS); m_texturesNormalMap[i] = MyTextureManager.GetTexture <MyTexture2D>("Textures\\Decals\\" + MyEnumsToStrings.Decals[i] + "_NormalMap", CheckTexture, LoadingMode.Immediate); MyUtils.AssertTexture(m_texturesNormalMap[i]); } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyDecals.LoadContent() - END"); }
/// <summary> /// Checks the normal map. /// </summary> /// <param name="texture">The texture.</param> private static void CheckTexture(MyTexture texture) { MyUtils.AssertTexture((MyTexture2D)texture); texture.TextureLoaded -= CheckTexture; }
public static void LoadContent() { MyMwcLog.WriteLine("MyCockpitGlassDecals.LoadContent() - START"); MyMwcLog.IncreaseIndent(); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyCockpitGlassDecals::LoadContent"); int texturesCount = MyEnumsToStrings.CockpitGlassDecals.Length; for (int i = 0; i < texturesCount; i++) { m_texturesDiffuse[i] = MyTextureManager.GetTexture <MyTexture2D>("Textures2\\Models\\Ships\\Cockpits\\Decals\\" + MyEnumsToStrings.CockpitGlassDecals[i] + "_Diffuse", t => MyUtils.AssertTexture((MyTexture2D)t)); } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyCockpitGlassDecals.LoadContent() - END"); }