当前位置: 首页>>代码示例>>Java>>正文


Java Vector4f类代码示例

本文整理汇总了Java中com.jme3.math.Vector4f的典型用法代码示例。如果您正苦于以下问题:Java Vector4f类的具体用法?Java Vector4f怎么用?Java Vector4f使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Vector4f类属于com.jme3.math包,在下文中一共展示了Vector4f类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromImageRaster

import com.jme3.math.Vector4f; //导入依赖的package包/类
public static Texel fromImageRaster(ImageRaster ir, Vector2f from, Vector2f to) {
	Vector4f pixels[][]=new Vector4f[(int)(to.x-from.x)][(int)(to.y-from.y)];
	for(int y=(int)from.y;y<to.y;y++){
		for(int x=(int)from.x;x<to.x;x++){
			int xl=(int)(x-from.x);
			int yl=(int)(y-from.y);

			Vector4f c;
			if(x>=ir.getWidth()||y>=ir.getHeight()||x<0||y<0){
				LOGGER.warn("Invalid coordinates x{} y{} for image w{} h{}. Use padding color.",x,y,ir.getWidth(),ir.getHeight());
				c=PADDINGPX_COLOR;
			}else{
				c=ir.getPixel(x,y).toVector4f();
			}

			pixels[xl][yl]=c;
		}
	}
	Texel tx=new Texel(PixelFormat.FLOAT_NORMALIZED_RGBA,pixels);
	tx.AREA=new Vector2f[]{from,to

	};
	return tx;
}
 
开发者ID:riccardobl,项目名称:DDSWriter,代码行数:25,代码来源:Texel.java

示例2: fromTexel

import com.jme3.math.Vector4f; //导入依赖的package包/类
public static Texel fromTexel(PixelFormat dest_format, Texel tx, Vector2f from, Vector2f to) {
	Vector4f pixels[][]=new Vector4f[(int)(to.x-from.x)][(int)(to.y-from.y)];
	for(int y=(int)from.y;y<to.y;y++){
		for(int x=(int)from.x;x<to.x;x++){
			int xl=(int)(x-from.x);
			int yl=(int)(y-from.y);

			Vector4f c;
			if(x>=tx.getWidth()||y>=tx.getHeight()||x<0||y<0){
				LOGGER.warn("Invalid coordinates x{} y{} for texel w{} h{}. Use padding color.",x,y,tx.getWidth(),tx.getHeight());
				c=PADDINGPX_COLOR;

			}else{
				c=tx.get(dest_format,x,y);
			}
			pixels[xl][yl]=c;
		}
	}
	Texel tnx=new Texel(PixelFormat.FLOAT_NORMALIZED_RGBA,pixels);

	tnx.AREA=new Vector2f[]{from,to

	};
	return tnx;
}
 
开发者ID:riccardobl,项目名称:DDSWriter,代码行数:26,代码来源:Texel.java

示例3: testConversion

import com.jme3.math.Vector4f; //导入依赖的package包/类
@Test 
public void testConversion(){
	Vector4f pixels[][]=new Vector4f[2][2];
	pixels[0][0]=new Vector4f(11,11,11,11);pixels[1][0]=new Vector4f(22,22,22,22);
	pixels[0][1]=new Vector4f(255,255,255,255);pixels[1][1]=new Vector4f(1,1,1,1);
	for(Vector4f pxs[]:pixels){
		for(Vector4f px:pxs){
			System.out.println(px);
		}
	}

	Texel texel=new Texel(PixelFormat.INT_RGBA,pixels);

	Vector4f pixel1=texel.get(PixelFormat.FLOAT_NORMALIZED_RGBA,0,0);
	Vector4f pixel2=new Vector4f(11f/255,11f/255,11f/255,11f/255);
	assertTrue("RGBA8_INT 2 RGBA8_FLOAT: "+pixel1+" != "+pixel2,pixel1.equals(pixel2));

}
 
开发者ID:riccardobl,项目名称:DDSWriter,代码行数:19,代码来源:TexelTest.java

示例4: createGrid

import com.jme3.math.Vector4f; //导入依赖的package包/类
private Geometry createGrid(
		AssetManager assetManager,
		String name,
		Vector3f plane,
		Vector3f direction,
		Vector3f up) {
	Vector4f color = new Vector4f(
			Math.abs(direction.x),
			Math.abs(direction.y),
			Math.abs(direction.z),
			1.0f);
	
	Material material = new Material(assetManager, "/Common/MatDefs/Misc/Unshaded.j3md");
	material.setVector4("Color", color);
	
	Grid grid = new Grid(8, 8, 1.0f);
	
	Geometry geometry = new Geometry(name, grid);
	geometry.lookAt(direction, up);
	geometry.setLocalTranslation(plane.mult(-4.0f));
	geometry.setMaterial(material);
	
	return geometry;
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:25,代码来源:GridsSpatial.java

示例5: setColor

import com.jme3.math.Vector4f; //导入依赖的package包/类
@Override
public void setColor(Color color, ColorBlendMode colorBlendMode) {
	Vector4f materialColor = (Vector4f)material.getParam("Color").getValue();
	
	if (color != null) {
		materialColor.setX((float)color.red);
		materialColor.setY((float)color.green);
		materialColor.setZ((float)color.blue);
		materialColor.setW((float)color.alpha);
		
		material.setInt("ColorBlendMode", ShaderUtil.getColorBlendModeAsInteger(colorBlendMode));
	} else {
		materialColor.setX(0.0f);
		materialColor.setY(0.0f);
		materialColor.setZ(0.0f);
		materialColor.setW(0.0f);
		
		material.setInt("ColorBlendMode", ShaderUtil.COLOR_BLEND_MODE_INVALID);
	}
	
	material.setVector4("Color", materialColor);
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:23,代码来源:CelestialObjectSpatial.java

示例6: modsTab

import com.jme3.math.Vector4f; //导入依赖的package包/类
private void modsTab(IconTabControl tabs) {
XTabPanelContent el = new XTabPanelContent(screen, "ModsContainer", LUtil.LAYOUT_SIZE);
       el.setIsMovable(false);
       el.setIsResizable(false);
       el.setLayoutManager(new MigLayout(screen, "gap 0, ins 0", "push[]push", "push[]push"));
       Container modsPanel = new Container(screen, "ModsPanel", Vector2f.ZERO,
               screen.getStyle("Mods").getVector2f("defaultSize"), Vector4f.ZERO, null);
       modsPanel.setLayoutManager(new MigLayout(screen, "wrap 2, gap 1, fill", "[grow, align left][grow, align left]", "push[][][][][][][][][][][][][][]push"));
       el.addChild(modsPanel);
       attackSpeedMod = addModLabel(modsPanel, "Attack:", inventoryAndEquipment.getAttackSpeedMod());
       blockMod = addModLabel(modsPanel, "Block :", inventoryAndEquipment.getBlockMod());
       castSpeedMod = addModLabel(modsPanel, "Cast :", inventoryAndEquipment.getCastSpeedMod());
       healingMod = addModLabel(modsPanel, "Healing :", inventoryAndEquipment.getHealingMod());
       magicCritMod = addModLabel(modsPanel, "Magic Crit:", inventoryAndEquipment.getMagicCritMod());
       magicHitMod = addModLabel(modsPanel, "Magic Hit:", inventoryAndEquipment.getMagicHitMod());
       meleeCritMod = addModLabel(modsPanel, "Melee Crit:", inventoryAndEquipment.getMeleeCritMod());
       meleeHitMod = addModLabel(modsPanel, "Melee Hit:", inventoryAndEquipment.getMeleeHitMod());
       parryMod = addModLabel(modsPanel, "Parry:", inventoryAndEquipment.getParryMod());
       regenerationMod = addModLabel(modsPanel, "Regeneration:", inventoryAndEquipment.getRegenHealthMod());
       runSpeedMod = addModLabel(modsPanel, "Run:", inventoryAndEquipment.getRunSpeedMod());
       tabs.addTabWithIcon("Stat modifiers", screen.getStyle("IconTab").getString("modImg"));
       tabs.addTabChild(2, el);
   }
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:24,代码来源:CharacterSheetAppState.java

示例7: BuildToolArea

import com.jme3.math.Vector4f; //导入依赖的package包/类
public BuildToolArea(ToolManager toolMgr, final ElementManager screen) {
	super(GameHudType.BUILD, toolMgr, screen, "BuildToolBar", "Buildbar", 7);
	//
	updateBarText();
	Container el = new Container(screen, UIDUtil.getUID(), mainToolBarStyle.getVector2f("propSearchPosition"),
			mainToolBarStyle.getVector2f("propSearchSize"), Vector4f.ZERO, null);
	el.setLayoutManager(new MigLayout(screen, "", "[][fill, grow][]", "[]"));
	propSearch = new AutocompleteTextField<String>(screen, this);
	propSearch.setToolTipText("Type in a partial or full prop name and press Ctrl+Space to list all props matching that name");
	el.addChild(new Label("Prop: ", screen));
	el.addChild(propSearch, "ay 50%");
	FancyButton add = new FancyButton(screen) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
			BuildAppState bas = screen.getApplication().getStateManager().getState(BuildAppState.class);
			bas.add(propSearch.getText());
		}
	};
	add.setText("Add");
	el.addChild(add);
	container.addChild(el);
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:23,代码来源:BuildToolArea.java

示例8: Surface

import com.jme3.math.Vector4f; //导入依赖的package包/类
/**
 * Constructor. Constructs required surface.
 * @param controlPoints space control points
 * @param nurbKnots knots of the surface
 * @param uSegments the amount of U segments
 * @param vSegments the amount of V segments
 * @param basisUFunctionDegree the degree of basis U function
 * @param basisVFunctionDegree the degree of basis V function
 */
private Surface(List<List<Vector4f>> controlPoints, List<Float>[] nurbKnots,
        int uSegments, int vSegments, int basisUFunctionDegree, int basisVFunctionDegree) {
    this.validateInputData(controlPoints, nurbKnots, uSegments, vSegments);
    this.type = SplineType.Nurb;
    this.uSegments = uSegments;
    this.vSegments = vSegments;
    this.controlPoints = controlPoints;
    this.knots = nurbKnots;
    this.basisUFunctionDegree = basisUFunctionDegree;
    CurveAndSurfaceMath.prepareNurbsKnots(nurbKnots[0], basisUFunctionDegree);
    if (nurbKnots[1] != null) {
        this.basisVFunctionDegree = basisVFunctionDegree;
        CurveAndSurfaceMath.prepareNurbsKnots(nurbKnots[1], basisVFunctionDegree);
    }

    this.buildSurface();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:Surface.java

示例9: validateInputData

import com.jme3.math.Vector4f; //导入依赖的package包/类
/**
 * This method validates the input data. It throws {@link IllegalArgumentException} if
 * the data is invalid.
 * @param controlPoints space control points
 * @param nurbKnots knots of the surface
 * @param uSegments the amount of U segments
 * @param vSegments the amount of V segments
 */
private void validateInputData(List<List<Vector4f>> controlPoints, List<Float>[] nurbKnots,
        int uSegments, int vSegments) {
    int uPointsAmount = controlPoints.get(0).size();
    for (int i = 1; i < controlPoints.size(); ++i) {
        if (controlPoints.get(i).size() != uPointsAmount) {
            throw new IllegalArgumentException("The amount of 'U' control points is invalid!");
        }
    }
    if (uSegments <= 0) {
        throw new IllegalArgumentException("U segments amount should be positive!");
    }
    if (vSegments < 0) {
        throw new IllegalArgumentException("V segments amount cannot be negative!");
    }
    if (nurbKnots.length != 2) {
        throw new IllegalArgumentException("Nurb surface should have two rows of knots!");
    }
    for (int i = 0; i < nurbKnots.length; ++i) {
        for (int j = 0; j < nurbKnots[i].size() - 1; ++j) {
            if (nurbKnots[i].get(j) > nurbKnots[i].get(j + 1)) {
                throw new IllegalArgumentException("The knots' values cannot decrease!");
            }
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:34,代码来源:Surface.java

示例10: drawImage

import com.jme3.math.Vector4f; //导入依赖的package包/类
public void drawImage(Image img, int dx, int dy, int dw, int dh) {
	BaseElement el = new BaseElement(renderer.getScreen(), getTranslatedPosition(dx, dy), new Size(dw, dh),
			Vector4f.ZERO, null);

	el.setIgnoreGlobalAlpha(true);
	el.setIgnoreMouse(true);
	el.setIgnoreTouch(true);
	el.setDimensions(dw, dh);
	el.setTexture(img);
	configureForDebug(el, "image");
	if (clipLayer != null) {
		el.addClippingLayer(clipLayer);
	}

	//
	renderer.addScrollableContent(el);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:18,代码来源:XHTMLCanvas.java

示例11: calcTextOffset

import com.jme3.math.Vector4f; //导入依赖的package包/类
@Override
protected Vector4f calcTextOffset(TableCell element, AnimText textElement, Vector4f textPadding) {
	Vector4f to = super.calcTextOffset(element, textElement, textPadding);
	final TableRow row = (TableRow) element.getElementParent();
	if (row != null) {
		final int cellIndex = row.getElements().indexOf(element);
		if (cellIndex == 0) {
			int depth = element.getDepth(row);
			Vector2f cellArrowSize;
			TableCell expanderCell;
			if (row.getParentRow() == null)
				expanderCell = element;
			else
				expanderCell = ((TableCell) row.getParentRow().getElements().get(0));
			cellArrowSize = expanderCell.expanderButton == null ? Vector2f.ZERO
					: expanderCell.expanderButton.calcPreferredSize();
			float tx = (row.table.notLeafCount > 0 ? cellArrowSize.x : 0) + (depth * cellArrowSize.x);
			to = to.clone();
			to.x += tx;
		}
	}
	return to;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:24,代码来源:TableCell.java

示例12: setAtlas

import com.jme3.math.Vector4f; //导入依赖的package包/类
@Override
public BaseElement setAtlas(Vector4f atlas) {
	PropertyDeclaration declX = new PropertyDeclaration(CssExtensions.ATLAS_X,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.x, String.format("%fpx", atlas.x)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declY = new PropertyDeclaration(CssExtensions.ATLAS_Y,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.y, String.format("%fpx", atlas.y)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declW = new PropertyDeclaration(CssExtensions.ATLAS_WIDTH,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.z, String.format("%fpx", atlas.z)), false,
			StylesheetInfo.USER);
	PropertyDeclaration declH = new PropertyDeclaration(CssExtensions.ATLAS_HEIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, atlas.w, String.format("%fpx", atlas.w)), false,
			StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declX);
	applyCss(declX);
	cssState.addAllCssDeclaration(declY);
	applyCss(declY);
	cssState.addAllCssDeclaration(declH);
	applyCss(declH);
	cssState.addAllCssDeclaration(declW);
	applyCss(declW);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例13: setHandlePosition

import com.jme3.math.Vector4f; //导入依赖的package包/类
@Override
public BaseElement setHandlePosition(Vector4f borderHandles) {
	PropertyDeclaration declLeft = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_LEFT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.w, String.format("%fpx", borderHandles.w)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declRight = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_RIGHT,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.y, String.format("%fpx", borderHandles.y)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declBottom = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_BOTTOM,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.z, String.format("%fpx", borderHandles.z)),
			false, StylesheetInfo.USER);
	PropertyDeclaration declTop = new PropertyDeclaration(CssExtensions.HANDLE_POSITION_TOP,
			new PropertyValue(CSSPrimitiveValue.CSS_PX, borderHandles.x, String.format("%fpx", borderHandles.x)),
			false, StylesheetInfo.USER);
	cssState.addAllCssDeclaration(declLeft);
	applyCss(declLeft);
	cssState.addAllCssDeclaration(declRight);
	applyCss(declRight);
	cssState.addAllCssDeclaration(declTop);
	applyCss(declTop);
	cssState.addAllCssDeclaration(declBottom);
	applyCss(declBottom);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:Element.java

示例14: calcClipping

import com.jme3.math.Vector4f; //导入依赖的package包/类
protected Vector4f calcClipping(BaseElement el) {
	BaseScreen screen = el.getScreen();
	clippedArea.set(0, 0, screen.getWidth(), screen.getHeight());
	if (el.isClippingEnabledInHeirarchy()) {
		for (ClippingDefine def : el.getClippingLayers()) {
			clipTest.set(def.getClipping());
			// TODO not sure why this is here. When enabled,
			// ProgressIndicator doesnt work in FancyWindow??
			// if (def.getElement() != el) {
			Vector4f pad = getClipPadding(def);
			clipTest.addLocal(pad.x, pad.y, -pad.z, -pad.w);
			// }
			clipArea(clipTest, clippedArea);
		}
	}
	return clippedArea;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:18,代码来源:AbstractGenericLayout.java

示例15: getAsString

import com.jme3.math.Vector4f; //导入依赖的package包/类
/**
 * 将目标对象转换为字符串形式
 * @param value
 * @return 
 */
public final static String getAsString(Object value) {
    if (value == null) 
        return null;
    
     if (value instanceof String) {
        return (String) value;
    } else if (value instanceof Vector2f) {
        Vector2f v2 = (Vector2f) value;
        return v2.x + "," + v2.y;
    } else if (value instanceof Vector3f) {
        Vector3f v3 = (Vector3f) value;
        return v3.x + "," + v3.y + "," + v3.z;
    } else if (value instanceof Vector4f) {
        Vector4f v4 = (Vector4f) value;
        return v4.x + "," + v4.y + "," + v4.z + "," + v4.w;
    } else if (value instanceof Quaternion) {
        Quaternion q4 = (Quaternion) value;
        return q4.getX() + "," + q4.getY() + "," + q4.getZ() + "," + q4.getW();
    } else if (value instanceof ColorRGBA) {
        ColorRGBA c4 = (ColorRGBA) value;
        return c4.r + "," + c4.g + "," + c4.b + "," + c4.a;
    }
    return value.toString();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:30,代码来源:Converter.java


注:本文中的com.jme3.math.Vector4f类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。