Interface IrisCompanionMeshResource

All Known Implementing Classes:
IrisCompanionMesh

public interface IrisCompanionMeshResource
GPU-resource-holder surface of 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 Type
    Method
    Description
    void
    Switches this VAO's UV2 attribute from per-draw-constant mode to per-vertex mode (reading from the auxiliary lightmap VBO).
    void
    bindLightmapForInstance(int slotIndex)
    Repoints the VAO's UV2 attribute at the given instance slot within the auxiliary lightmap VBO.
    void
    Releases all GL resources (VAO/VBO/EBO + auxiliary lightmap buffers) and native CPU scratch.
    boolean
    Attempts to build the companion VAO/VBO/EBO.
    void
    ensureLightmapCapacity(int requiredInstances)
    Grows the auxiliary per-instance lightmap VBO + CPU scratch to hold at least requiredInstances slots.
    void
    Makes all pending writeInstanceLightmap(int, float[]) writes visible to subsequent vertex fetches (memory barrier on the persistent-mapped path, glBufferSubData flush on the fallback path).
    int
     
    int
     
    int
     
    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.
    void
    Reverts the VAO back to per-draw-constant UV2 mode (disabled attribute array).
    boolean
     
    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.
  • Method Details

    • ensureBuilt

      boolean ensureBuilt()
      Attempts to build the companion VAO/VBO/EBO. Must be called on the render thread; returns false if a previous build failed.

      Implemented by IrisCompanionMesh.ensureBuilt().

    • getVaoId

      int getVaoId()
      Returns:
      GL handle of the companion VAO, or -1 when not built.

      Implemented by IrisCompanionMesh.getVaoId().

    • getIndexCount

      int getIndexCount()
      Returns:
      number of indices in the EBO (quadCount * 6), or 0 when 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:
      true if 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 -1 when absent.

      Implemented by IrisCompanionMesh.getUv2Location().

    • ensureLightmapCapacity

      void ensureLightmapCapacity(int requiredInstances)
      Grows the auxiliary per-instance lightmap VBO + CPU scratch to hold at least requiredInstances slots. 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 pending writeInstanceLightmap(int, float[]) writes visible to subsequent vertex fetches (memory barrier on the persistent-mapped path, glBufferSubData flush 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 between activatePerVertexLightmap() 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 with activatePerVertexLightmap().

      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 via RenderSystem.recordRenderCall.

      Implemented by IrisCompanionMesh.destroy().