• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TextureManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onSharedPreferenceChanged

import com.threed.jpct.TextureManager; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs,	String key) {
	Log.i("FlagRenderer", "Preferece Changed: "+ key); 
	if(key.equals(Settings.SKY_MODE_BACKGROUND_IMAGE))
		if (prefs.getString(key, "sky_night").equals(Settings.SKY_USER_BACKGROUND))
			userBackPrefUpdated = true;
		else{
			if(TextureManager.getInstance().containsTexture(Settings.SKY_USER_BACKGROUND))
				TextureManager.getInstance().removeAndUnload(Settings.SKY_USER_BACKGROUND, framebuffer);
		}
	else if(key.equals(Settings.FLAG_MODE_SETTING)){
		modePreferenceUpdated = true;
		imagePreferenceUpdated = true;
	}
	else if(key.equals(Settings.FLAG_SPEED)){
		modePreferenceUpdated = true;
	}
	else if(key.equals(Settings.DAY_TIME_SKY_BACKGROUND) && prefs.getBoolean(key, true))
		dayTimeUpdated = true;
	else if(key.equals(Settings.FLAG_IMAGE_SETTING)
			|| key.equals(Settings.SINGLE_FLAG_IMAGE_SETTING)
			|| key.equals(Settings.MULTIPLE_FLAG_IMAGE_SETTING)
			|| key.equals(Settings.MULTIPLE_FLAG_TIME_MIN))
		imagePreferenceUpdated = true;
}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:26,代码来源:FlagRenderer.java


示例2: parseTextures

import com.threed.jpct.TextureManager; //导入依赖的package包/类
/**
 * Loads all textures and add them to the JPCT TextureManager. Also returns
 * a a list of textures (can be used to separe textures loaded by the user
 * and textures loaded by the JPCTBlend importer.
 * 
 * @param xmlTextures
 *            textures root xml node
 * @return all loaded textures as a strings list
 */
private ArrayList<String> parseTextures(Node xmlTextures) {
	ArrayList<String> listTextures = new ArrayList<String>();

	NodeList childs = xmlTextures.getChildNodes();

	for (int i = 0, len = childs.getLength(); i < len; i++) {
		Node node = childs.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE) {

			String txName = node.getNodeName();
			Texture newTx = new Texture(sceneBasePath + "textures"
					+ File.separator + txName);

			TextureManager.getInstance().addTexture(txName, newTx);
			listTextures.add(txName);
		}
	}

	return listTextures;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:30,代码来源:JPCTBlendScene.java


示例3: getPlane

import com.threed.jpct.TextureManager; //导入依赖的package包/类
private Object3D getPlane() {
    Object3D object3D = Primitives.getPlane(2, 60);
    // Planes are rotated 180 degrees, so we need to flip them
    object3D.rotateX((float) Math.PI);
    // Load the AR Toolkit texture on top of the plane
    Texture texture = new Texture(getResources().getDrawable(R.drawable.artoolkit_logo));
    TextureManager.getInstance().addTexture("artoolkit", texture);

    object3D.setTexture("artoolkit");
    return object3D;
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:12,代码来源:ARSimple.java


示例4: unloadTextures

import com.threed.jpct.TextureManager; //导入依赖的package包/类
private void unloadTextures() {
    HashSet<String> names = TextureManager.getInstance().getNames();
    for (String name : names) {
        // DO NOT remove the dummy texture
        if (! name.equals(DUMMY_TEXTURE)) {
            TextureManager.getInstance().removeTexture(name);
        }
    }
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:10,代码来源:ArJpctActivity.java


示例5: onDrawFrame

import com.threed.jpct.TextureManager; //导入依赖的package包/类
@Override
	public void onDrawFrame(GL10 gl) {
		try{
			if(texture!=null){
				Log.i("FlagRenderer", "Texture to show: "+texture);
				FlagManager.loadTexture(texture);
				String oldTexture = flag.getUserObject()==null? null:((String)flag.getUserObject())+"";
				flag.setTexture(texture);
				flag.setUserObject(texture);
				if(oldTexture!=null && TextureManager.getInstance().containsTexture(oldTexture))
					TextureManager.getInstance().removeTexture(oldTexture);
				texture = null;
			}
			framebuffer.clear();
			if(prefs.getString(Settings.FLAG_MODE_SETTING, Settings.FLAG_MODE_FULLSCREEN).equals(Settings.FLAG_MODE_SKY)){
				String background = null;
//			if(prefs.getBoolean(Settings.DAY_TIME_SKY_BACKGROUND, true) && dayTimeUpdated)
//				background = DayTimeAlarmManager.getAttualDayTimeString();
//			else
				background = prefs.getString(Settings.SKY_MODE_BACKGROUND_IMAGE, "sky_night");
				FlagManager.loadTexture(background); 
				framebuffer.blit(TextureManager.getInstance().getTexture(background),
						(BitmapUtils.getBestFittingScreenPow(width,height)-width)/2,
						(BitmapUtils.getBestFittingScreenPow(width,height)-height)/2,
						0,0,
						width,height,FrameBuffer.OPAQUE_BLITTING);
			}
			world.renderScene(framebuffer);
			Animator.EnableAnimations();
			
			world.draw(framebuffer);
			framebuffer.display();
		}catch(OutOfMemoryError e){
//			TextureManager.getInstance().removeAndUnload(Settings.SKY_USER_BACKGROUND, framebuffer);
			prefs.edit().putString(Settings.SKY_MODE_BACKGROUND_IMAGE, "sky_night").commit();
			System.gc();
		}
	}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:39,代码来源:FlagRenderer.java


示例6: loadUserBanckgroundTexture

import com.threed.jpct.TextureManager; //导入依赖的package包/类
private void loadUserBanckgroundTexture(String textname,Bitmap bitmap){
	if(TextureManager.getInstance().containsTexture(textname)){
		TextureManager.getInstance().unloadTexture(framebuffer, TextureManager.getInstance().getTexture(textname));
		TextureManager.getInstance().replaceTexture(textname, new Texture(bitmap,true));
	}else
		TextureManager.getInstance().addTexture(textname, new Texture(bitmap,true));
	bitmap.recycle();
}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:9,代码来源:FlagRenderer.java


示例7: loadTexture

import com.threed.jpct.TextureManager; //导入依赖的package包/类
public static void loadTexture(String textureName){
		
		if(!TextureManager.getInstance().containsTexture(textureName)){
			if(textureName.startsWith(Settings.SKY_USER_BACKGROUND))
				loadUserTexture();
			else
				loadTexture(textureName, FlagIdsMap.get(textureName));
		}else;
//			Log.i("FlagManager", textureName + " already loaded");
	}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:11,代码来源:FlagManager.java


示例8: parseTextures

import com.threed.jpct.TextureManager; //导入依赖的package包/类
/**
 * Loads all textures and add them to the JPCT TextureManager. Also returns
 * a a list of textures (can be used to separe textures loaded by the user
 * and textures loaded by the JPCTBlend importer.
 * 
 * @param xmlTextures
 *            textures root xml node
 * @return all loaded textures as a strings list
 */
private ArrayList<String> parseTextures(Node xmlTextures) {
	ArrayList<String> listTextures = new ArrayList<String>();

	NodeList childs = xmlTextures.getChildNodes();

	for (int i = 0, len = childs.getLength(); i < len; i++) {
		Node node = childs.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE) {

			String txName = node.getNodeName();

			// try to load texture from assets folders
			InputStream is = null;
			try {
				is = assets.open(sceneBasePath + "textures"
						+ File.separator + txName);
				Log.d("jb", sceneBasePath + "textures" + File.separator
						+ txName);
			} catch (IOException e) {
				e.printStackTrace();
			}
			Log.d("jb", sceneBasePath + "textures" + File.separator
					+ txName);

			Texture newTx = new Texture(is);

			TextureManager.getInstance().addTexture(txName, newTx);
			listTextures.add(txName);
		}
	}

	return listTextures;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:43,代码来源:JPCTBlendScene.java


示例9: JpctTest

import com.threed.jpct.TextureManager; //导入依赖的package包/类
public JpctTest() throws Exception
{
	jframe = new JFrame("Hello world");
	jframe.setSize(800, 600);
	jframe.setVisible(true);
	jframe.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	
	world = new com.threed.jpct.World();
	world.setAmbientLight(0, 255, 0);

	
	Image img = ImageIO.read( getClass().getClassLoader().getResourceAsStream("Images/FullHeart.png") );
	assert (img != null);
	TextureManager.getInstance().addTexture("box", new Texture(img) );
	int id = TextureManager.getInstance().getTextureID("box");
	
	// Make a quad from (0,0) to (100, 100)
	Object3D obj = new Object3D(128);
	obj.addTriangle(new SimpleVector(0, 0, 0), 0, 0,
					new SimpleVector(100, 0, 0), 1, 0,
					new SimpleVector(0, 0, 100), 0, 1,
					id);
	obj.addTriangle(new SimpleVector(0, 0, 100), 0, 1,
					new SimpleVector(100, 0, 0), 1, 0,
					new SimpleVector(100, 0, 100), 1, 1,
					id);
	obj.setBaseTexture("box");
	obj.setCulling(false);
	obj.build();
	world.addObject(obj);
	
	world.setAmbientLight(255, 255, 255);

	box = Primitives.getBox(2f, 2f);
	box.setAdditionalColor(Color.red);
	box.setLighting(Object3D.LIGHTING_NO_LIGHTS);
	box.build();
	world.addObject(box);

	
	Vector3f eye = new Vector3f(50, -120, 100);
	Vector3f target = new Vector3f(50, 0, 50);
	
	// TODO: Make this work somehow
	Matrix4f camMatrix = MatrixUtil.createLookAt(eye, target, new Vector3f(0, 1, 0));
	Matrix ownLookAt = toJptcMatrix(camMatrix);
	world.getCamera().setBack(ownLookAt);
	
	world.getCamera().setPosition(eye.x, eye.y, eye.z);
	world.getCamera().lookAt(new SimpleVector(target.x, target.y, target.z));
	Matrix jptcLookAt = world.getCamera().getBack();
	System.out.println(jptcLookAt);
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:54,代码来源:JpctTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BasicHttpAuthenticationFilter类代码示例发布时间:2022-05-23
下一篇:
Java BasicAuthentication类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap