當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector3.mul方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.math.Vector3.mul方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector3.mul方法的具體用法?Java Vector3.mul怎麽用?Java Vector3.mul使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.math.Vector3的用法示例。


在下文中一共展示了Vector3.mul方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LevelScreen

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public LevelScreen(String mapName, float rot) {
    this.rot = rot;
    this.mapName = mapName;
    this.inputMapper = new InputMapper(AL.getInputConfig());

    inputMapper.registerInputHanlder(IInputConfig.InputKeys.up, new MoveEventHandler(new Vector2(0, 1)));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.down, new MoveEventHandler(new Vector2(0, -1)));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.right, new MoveEventHandler(new Vector2(1, 0)));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.left, new MoveEventHandler(new Vector2(-1, 0)));

    inputMapper.registerInputHanlder(IInputConfig.InputKeys.ability1, new AbillityEventHandler(Character.ABILITY_1));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.ability2, new AbillityEventHandler(Character.ABILITY_2));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.ability3, new AbillityEventHandler(Character.ABILITY_3));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.ability4, new AbillityEventHandler(Character.ABILITY_4));
    inputMapper.registerInputHanlder(IInputConfig.InputKeys.trait, new AbillityEventHandler(Character.TRAIT));

    rotationMatrix = new Matrix4().rotate(Vector3.X, rot);
    cameraVector = new Vector3(0, 1, 1);
    cameraVector.mul(rotationMatrix);
    invRotationMatrix = rotationMatrix.cpy().inv();
    lastMousePos = new Vector2(Gdx.input.getX(), Gdx.input.getY());
    tempVec = new Vector3();
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:24,代碼來源:LevelScreen.java

示例2: checkVisibility

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
	 * 相機包含測試
	 * @param transform 變換
	 * @param size 尺寸
	 * @param anchorPointInPoints 錨dian偏移
	 * @return
	 */
	public final boolean checkVisibility(final Matrix4 transform, final Size size, final Vector2 anchorPointInPoints) {
		final Director director = Director.getInstance();
	    //If draw to Rendertexture, return true directly.
	    // only cull the default camera. The culling algorithm is valid for default camera.
	    if (director.getRunningScene() == null) {// || (scene.getDefaultCamera() != Camera.getVisitingCamera())) {
	        return true;
	    }
	    
	    Vector2 temporigin = director.getVisibleOrigin();
	    Size tempsize = director.getVisibleSize();
	    Rect visiableRect = stackRect;
	    visiableRect.set(temporigin.x, temporigin.y, tempsize.width, tempsize.height);
	    
	    // transform center point to screen space
	    float hSizeX = size.width/2;
	    float hSizeY = size.height/2;
	    Vector3 v3p = stackVec3.set(hSizeX - anchorPointInPoints.x, hSizeY - anchorPointInPoints.y, 0);
	    v3p.mul(transform);
//	    transform.transformPoint(v3p);
	    Vector2 v2p = Camera.getVisitingCamera().projectGL(v3p);

	    // convert content size to world coordinates
	    final float[] val = transform.val;
	    float wshw = Math.max(Math.abs(hSizeX * val[Matrix4.M00] + hSizeY * val[Matrix4.M10]), 
	    		Math.abs(hSizeX * val[Matrix4.M00] - hSizeY * val[Matrix4.M10]));
//	    		std::max(fabsf(hSizeX * transform.m[0] + hSizeY * transform.m[4]), fabsf(hSizeX * transform.m[0] - hSizeY * transform.m[4]));
	    float wshh = Math.max(Math.abs(hSizeX * val[Matrix4.M01] + hSizeY * val[Matrix4.M11]), 
	    		Math.abs(hSizeX * val[Matrix4.M01] - hSizeY * val[Matrix4.M11])); 
//	    		std::max(fabsf(hSizeX * transform.m[1] + hSizeY * transform.m[5]), fabsf(hSizeX * transform.m[1] - hSizeY * transform.m[5]));
	    
	    // enlarge visible rect half size in screen coord
	    visiableRect.x -= wshw;
	    visiableRect.y -= wshh;
	    visiableRect.width += wshw * 2;
	    visiableRect.height += wshh * 2;
	    boolean ret = visiableRect.containsPoint(v2p);
//	    System.out.println("visiableRect = " + visiableRect + " pos = " + v2p);
	    return ret;
	}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:47,代碼來源:Renderer.java

示例3: convertToNodeSpace

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
     * Converts a Vector2 to node (local) space coordinates. The result is in Points.
     * <br>返回棧對象
     * <b>pool object</b>
     */
    public Vector2 convertToNodeSpace( Vector2 worldPoint) {
    	Matrix4 tmp = getWorldToNodeTransform();
//    	System.out.println("temp = " + tmp);
    	final Vector3 ret = poolVector3_1.set(worldPoint.x, worldPoint.y, 0);
    	ret.mul(tmp);
    	return poolVector2_1.set(ret.x, ret.y);
    }
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:13,代碼來源:Node.java

示例4: unproject

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
 * Convert the specified point of screen-space coordinate into the 3D world-space coordinate.
 *
 * Origin point at left top corner in screen-space.
 * @param size The window size to use.
 * @param src  The screen-space position.
 * @param dst  The 3D world-space position.
 */
public void unproject( Size size,  Vector3 src, Vector3 dst) {
	Vector3 screen = pool_vec3.set(src.x / size.width, ((size.height - src.y)) / size.height, src.z);
 screen.x = screen.x * 2.0f - 1.0f;
 screen.y = screen.y * 2.0f - 1.0f;
 screen.z = screen.z * 2.0f - 1.0f;
 
 projectionInv.set(getViewProjectionMatrix());
 projectionInv.inv();
 
 screen.mul(projectionInv);
 dst.set(screen);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Camera.java

示例5: unprojectGL

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
 * Convert the specified point of GL-screen-space coordinate into the 3D world-space coordinate.
 *
 * Origin point at left bottom corner in GL-screen-space.
 * @param size The window size to use.
 * @param src  The GL-screen-space position.
 * @param dst  The 3D world-space position.
 */
public void unprojectGL(Size size,  Vector3 src, Vector3 dst) {
	Vector3 screen = pool_vec3.set(src.x / size.width, src.y / size.height, src.z);
 screen.x = screen.x * 2.0f - 1.0f;
 screen.y = screen.y * 2.0f - 1.0f;
 screen.z = screen.z * 2.0f - 1.0f;
 
 projectionInv.set(getViewProjectionMatrix());
 projectionInv.inv();
 
 screen.mul(projectionInv);
 dst.set(screen);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Camera.java


注:本文中的com.badlogic.gdx.math.Vector3.mul方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。