@@ -115,10 +115,65 @@ public sealed class GlResourceManager : IDisposable
115115 { 10018 , ( "Steel" , "Directional brushed steel metal surface with specular grit." ) } ,
116116 { 10019 , ( "Latex" , "Glossy latex surface with steep specular falloff." ) } ,
117117 { 10020 , ( "Leather" , "Pebbled organic skin pores and warped wrinkles." ) } ,
118- { 10021 , ( "PolishedSteel" , "High-gloss chrome reflective steel surface." ) }
118+ { 10021 , ( "PolishedSteel" , "High-gloss chrome reflective steel surface." ) } ,
119+ { 10022 , ( "LeafCloud" , "Volumetric leaf cloud texture for bushes and tree canopies." ) } ,
120+ {
121+ 10023 ,
122+ ( "VolumetricLeafCloud" ,
123+ "Smooth volumetric leaf cloud texture with rounded leaf puffs and distinct canopy gaps." )
124+ } ,
125+ { 10024 , ( "TerrainGrass" , "Smooth low-noise terrain grass texture with macro color transitions." ) } ,
126+ { 10025 , ( "TerrainDirt" , "Soft muted terrain dirt texture with smooth soil transitions." ) } ,
127+ {
128+ 10026 ,
129+ ( "MountainRock" , "Mountain rock texture with macro height contours and directional slope shading." )
130+ } ,
131+ {
132+ 10027 ,
133+ ( "DungeonSandstone" , "Layered dungeon sandstone texture with domain-warped sedimentary strata." )
134+ } ,
135+ { 10028 , ( "DungeonSandstoneFlat" , "Flat soft-blended dungeon sandstone terrain texture." ) } ,
136+ { 10029 , ( "RawIron" , "Raw cast iron texture with fine surface pitting and micro-grit." ) } ,
137+ { 10030 , ( "WroughtIron" , "Wrought iron texture with subtle hammer marks and forged cellular facets." ) } ,
138+ { 10031 , ( "RustedIron" , "Rusted corroded iron texture with domain-warped oxidation layer." ) } ,
139+ { 10032 , ( "DesertSand" , "Desert sand texture with gentle directional wind ripples." ) } ,
140+ { 10033 , ( "DesertSandFlat" , "Flat soft-blended desert sand terrain texture for beds and background areas." ) }
119141 } ;
142+
120143 // --- PROCEDURAL LAZY LOADING INTEGRATION PASS ---
121144
145+ /// <summary>
146+ /// Initializes a new instance of the <see cref="GlResourceManager"/> class.
147+ /// </summary>
148+ public GlResourceManager ( )
149+ {
150+ _lazyNoiseGen = new NoiseGenerator ( 256 , 256 ) ;
151+ }
152+
153+ /// <summary>
154+ /// Sets the base resolution for dynamic procedural texture baking.
155+ /// </summary>
156+ /// <param name="width">Pixel width (e.g., 256, 512, 1024).</param>
157+ /// <param name="height">Pixel height (e.g., 256, 512, 1024).</param>
158+ /// <param name="clearExistingCache">If set to <c>true</c>, purges existing GL handles so textures re-bake at the new resolution.</param>
159+ public void SetProceduralResolution ( int width , int height , bool clearExistingCache = false )
160+ {
161+ _procWidth = width ;
162+ _procHeight = height ;
163+ _lazyNoiseGen = new NoiseGenerator ( width , height ) ;
164+
165+ if ( clearExistingCache )
166+ {
167+ foreach ( var handle in _bakedProceduralCache . Values )
168+ {
169+ GL . DeleteTexture ( handle ) ;
170+ _allTrackedHandles . Remove ( handle ) ;
171+ }
172+
173+ _bakedProceduralCache . Clear ( ) ;
174+ }
175+ }
176+
122177 /// <summary>
123178 /// Configures the base resolution and noise algorithm context used for dynamic on-demand baking.
124179 /// </summary>
@@ -200,7 +255,7 @@ private int LazyBakeTexture(int id)
200255 10003 => TextureMathEngine . GenerateWood ( _procWidth , _procHeight , _lazyNoiseGen ) ,
201256 10004 => TextureMathEngine . GenerateWave ( _procWidth , _procHeight , _lazyNoiseGen ) ,
202257 10005 => TextureMathEngine . GenerateCrosshatch ( _procWidth , _procHeight , lineSpacing : 32 ,
203- lineThickness : 2 ) ,
258+ lineThickness : 2 , bgR : 245 , bgG : 238 , bgB : 220 , bgA : 255 ) ,
204259 10006 => TextureMathEngine . GenerateConcrete ( _procWidth , _procHeight , _lazyNoiseGen ) ,
205260 10007 => TextureMathEngine . GenerateCanvas ( _procWidth , _procHeight , lineSpacing : 8 , lineThickness : 1 ) ,
206261 10008 => TextureFactory . GenerateTreeBark ( _procWidth , _procHeight , _lazyNoiseGen ) ,
@@ -217,6 +272,18 @@ private int LazyBakeTexture(int id)
217272 10019 => TextureFactory . GenerateLatex ( _procWidth , _procHeight , _lazyNoiseGen ) ,
218273 10020 => TextureFactory . GenerateLeather ( _procWidth , _procHeight , _lazyNoiseGen ) ,
219274 10021 => TextureFactory . GeneratePolishedSteel ( _procWidth , _procHeight , _lazyNoiseGen ) ,
275+ 10022 => TextureFactory . GenerateLeafCloud ( _procWidth , _procHeight , _lazyNoiseGen ) ,
276+ 10023 => TextureFactory . GenerateVolumetricLeafCloud ( _procWidth , _procHeight , _lazyNoiseGen ) ,
277+ 10024 => TextureFactory . GenerateTerrainGrass ( _procWidth , _procHeight , _lazyNoiseGen ) ,
278+ 10025 => TextureFactory . GenerateTerrainDirt ( _procWidth , _procHeight , _lazyNoiseGen ) ,
279+ 10026 => TextureFactory . GenerateMountainRock ( _procWidth , _procHeight , _lazyNoiseGen ) ,
280+ 10027 => TextureFactory . GenerateDungeonSandstone ( _procWidth , _procHeight , _lazyNoiseGen ) ,
281+ 10028 => TextureFactory . GenerateDungeonSandstoneFlat ( _procWidth , _procHeight , _lazyNoiseGen ) ,
282+ 10029 => TextureFactory . GenerateRawIron ( _procWidth , _procHeight , _lazyNoiseGen ) ,
283+ 10030 => TextureFactory . GenerateWroughtIron ( _procWidth , _procHeight , _lazyNoiseGen ) ,
284+ 10031 => TextureFactory . GenerateRustedIron ( _procWidth , _procHeight , _lazyNoiseGen ) ,
285+ 10032 => TextureFactory . GenerateDesertSand ( _procWidth , _procHeight , _lazyNoiseGen ) ,
286+ 10033 => TextureFactory . GenerateDesertSandFlat ( _procWidth , _procHeight , _lazyNoiseGen ) ,
220287 _ => null
221288 } ;
222289
@@ -467,24 +534,24 @@ public int GetShaderProgram(ShaderTypeApp appType)
467534 vertexSrc = ShaderResource . TexturedQuad2DVertexShader ;
468535 fragmentSrc = ShaderResource . TexturedQuad2DFragmentShader ;
469536 break ;
470- case ShaderTypeApp . PhongLighting : // UNUSED for now
537+ case ShaderTypeApp . PhongLighting :
471538 vertexSrc = ShaderResource . PhongLightingVertexShader ;
472539 fragmentSrc = ShaderResource . PhongLightingFragmentShader ;
473540 break ;
474- case ShaderTypeApp . Instancing : // UNUSED for now
541+ case ShaderTypeApp . Instancing :
475542 vertexSrc = ShaderResource . InstancingVertexShader ;
476543 fragmentSrc = ShaderResource . InstancingFragmentShader ;
477544 break ;
478545 case ShaderTypeApp . PostProcessing : // Now active for Painterly & Stylized Filters
479546 vertexSrc = ShaderResource . PostProcessingVertexShader ;
480547 fragmentSrc = ShaderResource . PostProcessingFragmentShader ;
481548 break ;
482- case ShaderTypeApp . WaterRipple : // UNUSED for now
549+ case ShaderTypeApp . WaterRipple :
483550 vertexSrc = ShaderResource . WaterRippleVertexShader ;
484551 fragmentSrc = ShaderResource . WaterRippleFragmentShader ;
485552 break ;
486553
487- case ShaderTypeApp . VolumetricFog : // UNUSED for now
554+ case ShaderTypeApp . VolumetricFog :
488555 vertexSrc = ShaderResource . VolumetricFogVertexShader ;
489556 fragmentSrc = ShaderResource . VolumetricFogFragmentShader ;
490557 break ;
0 commit comments