本文整理匯總了Java中com.jme3.math.Vector2f.multLocal方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector2f.multLocal方法的具體用法?Java Vector2f.multLocal怎麽用?Java Vector2f.multLocal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.math.Vector2f
的用法示例。
在下文中一共展示了Vector2f.multLocal方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createLumShader
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
private Material createLumShader(int srcW, int srcH, int bufW, int bufH, int mode,
int iters, Texture tex){
Material mat = new Material(manager, "Common/MatDefs/Hdr/LogLum.j3md");
Vector2f blockSize = new Vector2f(1f / bufW, 1f / bufH);
Vector2f pixelSize = new Vector2f(1f / srcW, 1f / srcH);
Vector2f blocks = new Vector2f();
float numPixels = Float.POSITIVE_INFINITY;
if (iters != -1){
do {
pixelSize.multLocal(2);
blocks.set(blockSize.x / pixelSize.x,
blockSize.y / pixelSize.y);
numPixels = blocks.x * blocks.y;
} while (numPixels > iters);
}else{
blocks.set(blockSize.x / pixelSize.x,
blockSize.y / pixelSize.y);
numPixels = blocks.x * blocks.y;
}
System.out.println(numPixels);
mat.setBoolean("Blocks", true);
if (mode == LUMMODE_ENCODE_LUM)
mat.setBoolean("EncodeLum", true);
else if (mode == LUMMODE_DECODE_LUM)
mat.setBoolean("DecodeLum", true);
mat.setTexture("Texture", tex);
mat.setVector2("BlockSize", blockSize);
mat.setVector2("PixelSize", pixelSize);
mat.setFloat("NumPixels", numPixels);
return mat;
}
示例2: Demonstrator
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
public Demonstrator(String name, MainApp app) {
this.name = name;
this.app = app;
rootNode = app.getRootNode();
cam = app.getViewPort().getCamera();
inputManager = app.getInputManager();
inventory = app.getInventory();
table = app.getTable();
visualAid = new Node(name + "VisualAid");
movingPlane = new Node(name + "MovingPlane");
visualAid.attachChild(movingPlane);
Factory factory = app.getFactory();
Vector2f planeSize = new Vector2f(table.getWidth(), table.getWidth());
planeSize.multLocal(4);
Geometry g = factory.makeUnshadedPlane(name + "MovingSubplane1",
planeSize.x, planeSize.y, new ColorRGBA(0.5f, 0.5f, 1, 0.3f));
g.setLocalTranslation(-planeSize.x / 2, -planeSize.y / 2, 0);
movingPlane.attachChild(g);
g = factory.makeUnshadedPlane(name + "MovingSubplane2",
planeSize.x, planeSize.y, new ColorRGBA(0.5f, 0.5f, 1, 0.3f));
g.setLocalRotation(new Quaternion(new float[]{0, FastMath.PI, 0}));
g.setLocalTranslation(planeSize.x / 2, -planeSize.y / 2, 0);
movingPlane.attachChild(g);
g = factory.makeUnshadedLine(name + "ShadowLine", Vector3f.ZERO,
new Vector3f(0, -planeSize.y / 2, 0), ColorRGBA.Black);
movingPlane.attachChild(g);
g = factory.makeUnshadedArrow(name + "AxisArrowX",
Vector3f.UNIT_X.mult(10), 2, ColorRGBA.Red);
g.setLocalTranslation(Vector3f.UNIT_X.negate().multLocal(5));
visualAid.attachChild(g);
g = factory.makeUnshadedArrow(name + "AxisArrowY",
Vector3f.UNIT_Y.mult(10), 2, ColorRGBA.Blue);
g.setLocalTranslation(Vector3f.UNIT_Y.negate().multLocal(5));
visualAid.attachChild(g);
g = factory.makeUnshadedArrow(name + "AxisArrowZ",
Vector3f.UNIT_Z.mult(10).negateLocal(), 2, ColorRGBA.Green);
g.setLocalTranslation(Vector3f.UNIT_Z.mult(5));
visualAid.attachChild(g);
sceneProcessor = new DemoSceneProcessor(app, visualAid);
app.getViewPort().addProcessor(sceneProcessor);
for (HandId hId : HandId.values()) {
int hIndex = hId.getValue();
hands[hIndex] = new Hand(name + " graspNode" + hIndex, hId);
}
selectHand(HandId.AnyHand);
}
示例3: multInBuffer
import com.jme3.math.Vector2f; //導入方法依賴的package包/類
/**
* Multiply and store a Vector2f in-buffer.
*
* @param toMult
* the vector to multiply against
* @param buf
* the buffer to find the Vector2f within
* @param index
* the position (in terms of vectors, not floats) of the vector
* to multiply
*/
public static void multInBuffer(Vector2f toMult, FloatBuffer buf, int index) {
TempVars vars = TempVars.get();
Vector2f tempVec2 = vars.vect2d;
populateFromBuffer(tempVec2, buf, index);
tempVec2.multLocal(toMult);
setInBuffer(tempVec2, buf, index);
vars.release();
}