Interface IrisCompanionMeshResource
- All Known Implementing Classes:
IrisCompanionMesh
IrisCompanionMesh.
Declares only methods that manage VAO/VBO/EBO and auxiliary lightmap VBO
state. Draw-call issuance and shader-state interpretation are intentionally
excluded — they belong to IrisCompanionMeshRenderer.
IrisCompanionMesh implements this interface; call sites that only
need GPU lifecycle can depend on this type.
-
Method Summary
Modifier and TypeMethodDescriptionvoidSwitches this VAO's UV2 attribute from per-draw-constant mode to per-vertex mode (reading from the auxiliary lightmap VBO).voidbindLightmapForInstance(int slotIndex) Repoints the VAO's UV2 attribute at the given instance slot within the auxiliary lightmap VBO.voiddestroy()Releases all GL resources (VAO/VBO/EBO + auxiliary lightmap buffers) and native CPU scratch.booleanAttempts to build the companion VAO/VBO/EBO.voidensureLightmapCapacity(int requiredInstances) Grows the auxiliary per-instance lightmap VBO + CPU scratch to hold at leastrequiredInstancesslots.voidMakes all pendingwriteInstanceLightmap(int, float[])writes visible to subsequent vertex fetches (memory barrier on the persistent-mapped path,glBufferSubDataflush on the fallback path).intintintgetVaoId()voidprepareForShader(int programId) Resolves Iris-injected attribute locations (iris_Entity, mc_midTexCoord, at_tangent) for the given GL program and binds VBO pointers on this VAO.voidReverts the VAO back to per-draw-constant UV2 mode (disabled attribute array).booleanvoidwriteInstanceLightmap(int slotIndex, float[] corner16) Computes per-vertex UV2 for the given instance slot by combining the supplied corner lightmap samples with the precomputed trilinear weights, and stages the result for upload.
-
Method Details
-
ensureBuilt
boolean ensureBuilt()Attempts to build the companion VAO/VBO/EBO. Must be called on the render thread; returnsfalseif a previous build failed.Implemented by
IrisCompanionMesh.ensureBuilt(). -
getVaoId
int getVaoId()- Returns:
- GL handle of the companion VAO, or
-1when not built.Implemented by
IrisCompanionMesh.getVaoId().
-
getIndexCount
int getIndexCount()- Returns:
- number of indices in the EBO (
quadCount * 6), or0when not built.Implemented by
IrisCompanionMesh.getIndexCount().
-
prepareForShader
void prepareForShader(int programId) Resolves Iris-injected attribute locations (iris_Entity, mc_midTexCoord, at_tangent) for the given GL program and binds VBO pointers on this VAO. Results are cached per program ID and invalidated on Iris pipeline generation changes.Implemented by
IrisCompanionMesh.prepareForShader(int). -
supportsPerVertexLightmap
boolean supportsPerVertexLightmap()- Returns:
trueif this mesh has a UV2 attribute and precomputed per-vertex trilinear weights, i.e. per-vertex lightmap upload is supported.Implemented by
IrisCompanionMesh.supportsPerVertexLightmap().
-
getUv2Location
int getUv2Location()- Returns:
- GL attribute location of UV2 (lightmap) within this VAO, or
-1when absent.Implemented by
IrisCompanionMesh.getUv2Location().
-
ensureLightmapCapacity
void ensureLightmapCapacity(int requiredInstances) Grows the auxiliary per-instance lightmap VBO + CPU scratch to hold at leastrequiredInstancesslots. No-op if already large enough. Render-thread only.Implemented by
IrisCompanionMesh.ensureLightmapCapacity(int). -
writeInstanceLightmap
void writeInstanceLightmap(int slotIndex, float[] corner16) Computes per-vertex UV2 for the given instance slot by combining the supplied corner lightmap samples with the precomputed trilinear weights, and stages the result for upload.Implemented by
IrisCompanionMesh.writeInstanceLightmap(int, float[]). -
finishLightmapWrites
void finishLightmapWrites()Makes all pendingwriteInstanceLightmap(int, float[])writes visible to subsequent vertex fetches (memory barrier on the persistent-mapped path,glBufferSubDataflush on the fallback path).Implemented by
IrisCompanionMesh.finishLightmapWrites(). -
activatePerVertexLightmap
void activatePerVertexLightmap()Switches this VAO's UV2 attribute from per-draw-constant mode to per-vertex mode (reading from the auxiliary lightmap VBO). Idempotent. Caller must have the VAO bound.Implemented by
IrisCompanionMesh.activatePerVertexLightmap(). -
bindLightmapForInstance
void bindLightmapForInstance(int slotIndex) Repoints the VAO's UV2 attribute at the given instance slot within the auxiliary lightmap VBO. Must be called betweenactivatePerVertexLightmap()and the per-instance draw.Implemented by
IrisCompanionMesh.bindLightmapForInstance(int). -
restoreConstantLightmap
void restoreConstantLightmap()Reverts the VAO back to per-draw-constant UV2 mode (disabled attribute array). Paired withactivatePerVertexLightmap().Implemented by
IrisCompanionMesh.restoreConstantLightmap(). -
destroy
void destroy()Releases all GL resources (VAO/VBO/EBO + auxiliary lightmap buffers) and native CPU scratch. Safe to call off the render thread - deletion is deferred viaRenderSystem.recordRenderCall.Implemented by
IrisCompanionMesh.destroy().
-