refactor(animation):优化动画系统字段不可变性与getter方法格式- 将AnimationClip中的creationTime字段设为final
- 将AnimationLayer中的parameterOverrides字段设为final - 将AnimationParameter中的id、defaultValue、minValue、maxValue字段设为final - 将LightSource中的position、color、intensity字段设为final - 统一所有getter方法的代码格式,增加换行与大括号 - 优化Mesh2D中部分条件判断逻辑与字段final声明- 调整部分JavaDoc注释格式与空行位置提升可读性
This commit is contained in:
@@ -6,7 +6,10 @@ import com.chuangzhou.vivid2D.render.systems.buffer.Tesselator;
|
||||
import com.chuangzhou.vivid2D.render.systems.sources.ShaderManagement;
|
||||
import com.chuangzhou.vivid2D.render.systems.sources.ShaderProgram;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
import org.lwjgl.stb.STBTTAlignedQuad;
|
||||
import org.lwjgl.stb.STBTTBakedChar;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
@@ -15,10 +18,12 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static org.lwjgl.stb.STBTruetype.*;
|
||||
import static org.lwjgl.stb.STBTruetype.stbtt_BakeFontBitmap;
|
||||
import static org.lwjgl.stb.STBTruetype.stbtt_GetBakedQuad;
|
||||
|
||||
/**
|
||||
* 支持 ASCII + 中文的 OpenGL 文本渲染器
|
||||
*
|
||||
* @author tzdwindows 7
|
||||
*/
|
||||
public final class TextRenderer {
|
||||
@@ -153,7 +158,7 @@ public final class TextRenderer {
|
||||
width += bakedChar.xadvance() * scale;
|
||||
} else {
|
||||
// 对于未找到的字符,使用空格宽度
|
||||
width += 0.5f * scale; // 估计值
|
||||
width += 0.5f * scale; // 估计值
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,7 +322,15 @@ public final class TextRenderer {
|
||||
logger.debug("TextRenderer cleaned up");
|
||||
}
|
||||
|
||||
public boolean isInitialized() { return initialized; }
|
||||
public int getAsciiTextureId() { return asciiTextureId; }
|
||||
public int getChineseTextureId() { return chineseTextureId; }
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public int getAsciiTextureId() {
|
||||
return asciiTextureId;
|
||||
}
|
||||
|
||||
public int getChineseTextureId() {
|
||||
return chineseTextureId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user