Std140Builder.java

com.mojang.blaze3d.buffers.Std140Builder

信息

  • 全限定名:com.mojang.blaze3d.buffers.Std140Builder
  • 类型:public class
  • 包:com.mojang.blaze3d.buffers
  • 源码路径:src/main/java/com/mojang/blaze3d/buffers/Std140Builder.java
  • 起始行号:L17
  • 职责:

    TODO

字段/常量

  • buffer

    • 类型: ByteBuffer
    • 修饰符: private final
    • 源码定位: L18
    • 说明:

      TODO

  • start

    • 类型: int
    • 修饰符: private final
    • 源码定位: L19
    • 说明:

      TODO

内部类/嵌套类型

构造器

private Std140Builder(ByteBuffer buffer) @ L21

  • 构造器名:Std140Builder
  • 源码定位:L21
  • 修饰符:private

参数:

  • buffer: ByteBuffer

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static Std140Builder intoBuffer(ByteBuffer buffer) @ L26

  • 方法名:intoBuffer
  • 源码定位:L26
  • 返回类型:Std140Builder
  • 修饰符:public static

参数:

  • buffer: ByteBuffer

说明:

TODO

public static Std140Builder onStack(MemoryStack stack, int size) @ L30

  • 方法名:onStack
  • 源码定位:L30
  • 返回类型:Std140Builder
  • 修饰符:public static

参数:

  • stack: MemoryStack
  • size: int

说明:

TODO

public ByteBuffer get() @ L34

  • 方法名:get
  • 源码定位:L34
  • 返回类型:ByteBuffer
  • 修饰符:public

参数:

说明:

TODO

public Std140Builder align(int alignment) @ L38

  • 方法名:align
  • 源码定位:L38
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • alignment: int

说明:

TODO

public Std140Builder putFloat(float value) @ L44

  • 方法名:putFloat
  • 源码定位:L44
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • value: float

说明:

TODO

public Std140Builder putInt(int value) @ L50

  • 方法名:putInt
  • 源码定位:L50
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • value: int

说明:

TODO

public Std140Builder putVec2(float x, float y) @ L56

  • 方法名:putVec2
  • 源码定位:L56
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: float
  • y: float

说明:

TODO

public Std140Builder putVec2(Vector2fc vec) @ L63

  • 方法名:putVec2
  • 源码定位:L63
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector2fc

说明:

TODO

public Std140Builder putIVec2(int x, int y) @ L70

  • 方法名:putIVec2
  • 源码定位:L70
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: int
  • y: int

说明:

TODO

public Std140Builder putIVec2(Vector2ic vec) @ L77

  • 方法名:putIVec2
  • 源码定位:L77
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector2ic

说明:

TODO

public Std140Builder putVec3(float x, float y, float z) @ L84

  • 方法名:putVec3
  • 源码定位:L84
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: float
  • y: float
  • z: float

说明:

TODO

public Std140Builder putVec3(Vector3fc vec) @ L93

  • 方法名:putVec3
  • 源码定位:L93
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector3fc

说明:

TODO

public Std140Builder putIVec3(int x, int y, int z) @ L100

  • 方法名:putIVec3
  • 源码定位:L100
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: int
  • y: int
  • z: int

说明:

TODO

public Std140Builder putIVec3(Vector3ic vec) @ L109

  • 方法名:putIVec3
  • 源码定位:L109
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector3ic

说明:

TODO

public Std140Builder putVec4(float x, float y, float z, float w) @ L116

  • 方法名:putVec4
  • 源码定位:L116
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: float
  • y: float
  • z: float
  • w: float

说明:

TODO

public Std140Builder putVec4(Vector4fc vec) @ L125

  • 方法名:putVec4
  • 源码定位:L125
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector4fc

说明:

TODO

public Std140Builder putIVec4(int x, int y, int z, int w) @ L132

  • 方法名:putIVec4
  • 源码定位:L132
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • x: int
  • y: int
  • z: int
  • w: int

说明:

TODO

public Std140Builder putIVec4(Vector4ic vec) @ L141

  • 方法名:putIVec4
  • 源码定位:L141
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Vector4ic

说明:

TODO

public Std140Builder putMat4f(Matrix4fc vec) @ L148

  • 方法名:putMat4f
  • 源码定位:L148
  • 返回类型:Std140Builder
  • 修饰符:public

参数:

  • vec: Matrix4fc

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class Std140Builder {
    private final ByteBuffer buffer;
    private final int start;
 
    private Std140Builder(ByteBuffer buffer) {
        this.buffer = buffer;
        this.start = buffer.position();
    }
 
    public static Std140Builder intoBuffer(ByteBuffer buffer) {
        return new Std140Builder(buffer);
    }
 
    public static Std140Builder onStack(MemoryStack stack, int size) {
        return new Std140Builder(stack.malloc(size));
    }
 
    public ByteBuffer get() {
        return this.buffer.flip();
    }
 
    public Std140Builder align(int alignment) {
        int position = this.buffer.position();
        this.buffer.position(this.start + Mth.roundToward(position - this.start, alignment));
        return this;
    }
 
    public Std140Builder putFloat(float value) {
        this.align(4);
        this.buffer.putFloat(value);
        return this;
    }
 
    public Std140Builder putInt(int value) {
        this.align(4);
        this.buffer.putInt(value);
        return this;
    }
 
    public Std140Builder putVec2(float x, float y) {
        this.align(8);
        this.buffer.putFloat(x);
        this.buffer.putFloat(y);
        return this;
    }
 
    public Std140Builder putVec2(Vector2fc vec) {
        this.align(8);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 8);
        return this;
    }
 
    public Std140Builder putIVec2(int x, int y) {
        this.align(8);
        this.buffer.putInt(x);
        this.buffer.putInt(y);
        return this;
    }
 
    public Std140Builder putIVec2(Vector2ic vec) {
        this.align(8);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 8);
        return this;
    }
 
    public Std140Builder putVec3(float x, float y, float z) {
        this.align(16);
        this.buffer.putFloat(x);
        this.buffer.putFloat(y);
        this.buffer.putFloat(z);
        this.buffer.position(this.buffer.position() + 4);
        return this;
    }
 
    public Std140Builder putVec3(Vector3fc vec) {
        this.align(16);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 16);
        return this;
    }
 
    public Std140Builder putIVec3(int x, int y, int z) {
        this.align(16);
        this.buffer.putInt(x);
        this.buffer.putInt(y);
        this.buffer.putInt(z);
        this.buffer.position(this.buffer.position() + 4);
        return this;
    }
 
    public Std140Builder putIVec3(Vector3ic vec) {
        this.align(16);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 16);
        return this;
    }
 
    public Std140Builder putVec4(float x, float y, float z, float w) {
        this.align(16);
        this.buffer.putFloat(x);
        this.buffer.putFloat(y);
        this.buffer.putFloat(z);
        this.buffer.putFloat(w);
        return this;
    }
 
    public Std140Builder putVec4(Vector4fc vec) {
        this.align(16);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 16);
        return this;
    }
 
    public Std140Builder putIVec4(int x, int y, int z, int w) {
        this.align(16);
        this.buffer.putInt(x);
        this.buffer.putInt(y);
        this.buffer.putInt(z);
        this.buffer.putInt(w);
        return this;
    }
 
    public Std140Builder putIVec4(Vector4ic vec) {
        this.align(16);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 16);
        return this;
    }
 
    public Std140Builder putMat4f(Matrix4fc vec) {
        this.align(16);
        vec.get(this.buffer);
        this.buffer.position(this.buffer.position() + 64);
        return this;
    }
}

引用的其他类

  • Mth
    • 引用位置: 方法调用
    • 关联成员: Mth.roundToward()