六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 52|回复: 0

从 wwj 中抠星星

[复制链接]

升级  66%

9

主题

9

主题

9

主题

童生

Rank: 1

积分
33
 楼主| 发表于 2013-2-1 11:59:25 | 显示全部楼层 |阅读模式
try {
float r, g, b, x, y, z;
String strR, strG, strB, strX, strY, strZ;
StringBuilder builder = new StringBuilder();
DecimalFormat decimalFormat = new DecimalFormat("#.000000");
builder.append(numStars).append(",").append(
decimalFormat.format(radius)).append("\n");
FileOutputStream stream = new FileOutputStream("C:/stars.txt");

for (int i = 0; i < numStars; i += 6) {
r = starsBuffer.get(i + 0) * 255;
g = starsBuffer.get(i + 1) * 255;
b = starsBuffer.get(i + 2) * 255;
strR = String.valueOf(r);
strR = strR.substring(0, strR.indexOf("."));
strG = String.valueOf(g);
strG = strG.substring(0, strG.indexOf("."));
strB = String.valueOf(b);
strB = strB.substring(0, strB.indexOf("."));
x = starsBuffer.get(i + 3);
y = starsBuffer.get(i + 4);
z = starsBuffer.get(i + 5);
strX = decimalFormat.format(x);
strY = decimalFormat.format(y);
strZ = decimalFormat.format(z);

builder.append(strX).append(",").append(strY).append(",")
.append(strZ).append(",").append(strR).append(",")
.append(strG).append(",").append(strB).append(",")
.append("\n");
}

stream.write(builder.toString().getBytes());
stream.close();
} catch (Exception e) {
e.printStackTrace();
}

问题是,wwj是怎么渲染出星星来的呢?
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表