本文整理汇总了Java中com.jme3.math.ColorRGBA.set方法的典型用法代码示例。如果您正苦于以下问题:Java ColorRGBA.set方法的具体用法?Java ColorRGBA.set怎么用?Java ColorRGBA.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.ColorRGBA
的用法示例。
在下文中一共展示了ColorRGBA.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setColor
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
public ColorRGBA setColor() {
Color cColor = jColorChooser1.getColor();
ColorRGBA color = new ColorRGBA();
float[] floats = new float[4];
cColor.getComponents(floats);
color.set(floats[0], floats[1], floats[2], ((float)alphaSlider.getValue())/100.0f);
ColorRGBA color2 = new ColorRGBA((ColorRGBA) editor.getValue());
editor.setValue(color);
editor.notifyListeners(color2, color);
return color;
}
示例2: readColor
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
protected ColorRGBA readColor(){
ColorRGBA v = new ColorRGBA();
v.set(scan.nextFloat(), scan.nextFloat(), scan.nextFloat(), 1.0f);
return v;
}
示例3: convertColor
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
private ColorRGBA convertColor(Color inColor, ColorRGBA outColor){
return outColor.set(inColor.getRed(), inColor.getGreen(), inColor.getBlue(), inColor.getAlpha());
}
示例4: initFlagCopy
import com.jme3.math.ColorRGBA; //导入方法依赖的package包/类
private void initFlagCopy() {
if (flagCopyInitialized) {
return;
}
String cacheID = DebugTools.class.getName()+"_FlagCopy";
Program program = solver.clSettings.getProgramCache().loadFromCache(cacheID);
if (program == null) {
String source =
"#define L_INVSZ(i, vi, sz) (vi).y = i / (sz).x; (vi).x = (i - (vi).y*(sz).x);\n" +
"__kernel void CopyFlags(__global char* flagGrid, __global float4* colors, __write_only image2d_t image, int sizeX, int sizeY)\n" +
"{\n" +
" int idx = get_global_id(0);\n" +
" int2 dim = (int2)(sizeX, sizeY);\n" +
" int2 pos;\n" +
" L_INVSZ(idx, pos, dim);\n" +
" char flag = flagGrid[idx];\n" +
" float4 color = colors[flag];\n" +
" write_imagef(image, pos, color);\n" +
"}";
program = solver.clSettings.getClContext().createProgramFromSourceCode(source);
program.build();
solver.clSettings.getProgramCache().saveToCache(cacheID, program);
}
program.register();
flagCopyKernel = program.createKernel("CopyFlags");
ByteBuffer bb = BufferUtils.createByteBuffer(256*4*4);
FloatBuffer fb = bb.asFloatBuffer();
EnumMap<FlagGrid.CellType, ColorRGBA> flagColors = new EnumMap<>(FlagGrid.CellType.class);
flagColors.put(FlagGrid.CellType.TypeInflow, new ColorRGBA(0, 1, 0, 0.5f));
flagColors.put(FlagGrid.CellType.TypeOutflow, new ColorRGBA(0, 0, 1, 0.5f));
flagColors.put(FlagGrid.CellType.TypeObstacle, new ColorRGBA(1, 0, 0, 1));
for (int i=0; i<256; ++i) {
ColorRGBA col = new ColorRGBA(0, 0, 0, 0);
for (EnumMap.Entry<FlagGrid.CellType, ColorRGBA> e : flagColors.entrySet()) {
if ((i & e.getKey().value) != 0) {
ColorRGBA c = e.getValue();
float ac = c.a + (1-c.a)*col.a;
col.set((c.a*c.r + (1-c.a)*col.a*col.r)/ac, (c.a*c.g + (1-c.a)*col.a*col.g)/ac, (c.a*c.b + (1-c.a)*col.a*col.b)/ac, ac);
}
}
System.out.println("flag "+i+" ("+Integer.toBinaryString(i)+"): "+col);
fb.put(col.r).put(col.g).put(col.b).put(col.a);
}
flagColorsBuffer = solver.clSettings.getClContext().createBuffer(256*4*4);
flagColorsBuffer.write(solver.clSettings.getClCommandQueue(), bb);
flagCopyInitialized = true;
}