Prefer StringBuilder where possible.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@962 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -71,11 +71,11 @@ public class StatsDisplay extends Node
|
|||||||
_stats.setLength(0);
|
_stats.setLength(0);
|
||||||
_stats.append("FPS: ").append((int)timer.getFrameRate());
|
_stats.append("FPS: ").append((int)timer.getFrameRate());
|
||||||
_stats.append(" - ").append(renderer.getStatistics(_temp));
|
_stats.append(" - ").append(renderer.getStatistics(_temp));
|
||||||
_text.print(_stats);
|
_text.print(_stats.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Text _text;
|
protected Text _text;
|
||||||
protected StringBuffer _stats = new StringBuffer();
|
protected StringBuilder _stats = new StringBuilder();
|
||||||
protected StringBuffer _temp = new StringBuffer();
|
protected StringBuffer _temp = new StringBuffer();
|
||||||
|
|
||||||
protected static final String DEFAULT_JME_FONT =
|
protected static final String DEFAULT_JME_FONT =
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class ShaderCache
|
|||||||
// fetch the shader source
|
// fetch the shader source
|
||||||
String source = _sources.get(shader);
|
String source = _sources.get(shader);
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(
|
BufferedReader reader = new BufferedReader(
|
||||||
new InputStreamReader(_rsrcmgr.getResource(shader)));
|
new InputStreamReader(_rsrcmgr.getResource(shader)));
|
||||||
@@ -202,7 +202,7 @@ public class ShaderCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prepend the definitions (the version directive comes before anything else)
|
// prepend the definitions (the version directive comes before anything else)
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("#version 110\n");
|
buf.append("#version 110\n");
|
||||||
for (String def : defs) {
|
for (String def : defs) {
|
||||||
buf.append("#define ").append(def).append('\n');
|
buf.append("#define ").append(def).append('\n');
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ public abstract class ShaderConfig
|
|||||||
protected void getDerivedDefinitions (ArrayList<String> ddefs)
|
protected void getDerivedDefinitions (ArrayList<String> ddefs)
|
||||||
{
|
{
|
||||||
// add the def that sets the front color based on the light types
|
// add the def that sets the front color based on the light types
|
||||||
StringBuffer buf = new StringBuffer("SET_FRONT_COLOR ");
|
StringBuilder buf = new StringBuilder("SET_FRONT_COLOR ");
|
||||||
if (_lights != null) {
|
if (_lights != null) {
|
||||||
// start with the "scene color," which combines scene ambient, emissivity, etc.
|
// start with the "scene color," which combines scene ambient, emissivity, etc.
|
||||||
buf.append("vec3 frontColor = gl_FrontLightModelProduct.sceneColor.rgb; ");
|
buf.append("vec3 frontColor = gl_FrontLightModelProduct.sceneColor.rgb; ");
|
||||||
@@ -254,7 +254,7 @@ public abstract class ShaderConfig
|
|||||||
ddefs.add(buf.toString());
|
ddefs.add(buf.toString());
|
||||||
|
|
||||||
// add the def that sets the texture coordinates based on the env map modes
|
// add the def that sets the texture coordinates based on the env map modes
|
||||||
buf = new StringBuffer("SET_TEX_COORDS");
|
buf = new StringBuilder("SET_TEX_COORDS");
|
||||||
if (_textures != null) {
|
if (_textures != null) {
|
||||||
for (int ii = 0; ii < _textures.length; ii++) {
|
for (int ii = 0; ii < _textures.length; ii++) {
|
||||||
TextureConfig texture = _textures[ii];
|
TextureConfig texture = _textures[ii];
|
||||||
@@ -272,7 +272,7 @@ public abstract class ShaderConfig
|
|||||||
ddefs.add(buf.toString());
|
ddefs.add(buf.toString());
|
||||||
|
|
||||||
// add the definition that sets the fog alpha based on the density function
|
// add the definition that sets the fog alpha based on the density function
|
||||||
buf = new StringBuffer("SET_FOG_ALPHA");
|
buf = new StringBuilder("SET_FOG_ALPHA");
|
||||||
if (_fogDensityFunc == FogState.DF_EXP) {
|
if (_fogDensityFunc == FogState.DF_EXP) {
|
||||||
buf.append(" fogAlpha = exp(gl_Fog.density * eyeVertex.z);");
|
buf.append(" fogAlpha = exp(gl_Fog.density * eyeVertex.z);");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user