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


Java Connect類代碼示例

本文整理匯總了Java中rajawali.parser.fbx.FBXValues.Connections.Connect的典型用法代碼示例。如果您正苦於以下問題:Java Connect類的具體用法?Java Connect怎麽用?Java Connect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Connect類屬於rajawali.parser.fbx.FBXValues.Connections包,在下文中一共展示了Connect類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMaterialForMesh

import rajawali.parser.fbx.FBXValues.Connections.Connect; //導入依賴的package包/類
private AMaterial getMaterialForMesh(BaseObject3D o, String name) {
    AMaterial mat = new SimpleMaterial();
    Material material = null;
    Stack<Connect> conns = mFbx.connections.connections;
    int num = conns.size();
    String materialName = null;

    for (int i = 0; i < num; ++i) {
        if (conns.get(i).object2.equals(name)) {
            materialName = conns.get(i).object1;
            break;
        }
    }

    if (materialName != null) {
        Stack<Material> materials = mFbx.objects.materials;
        num = materials.size();
        for (int i = 0; i < num; ++i) {
            if (materials.get(i).name.equals(materialName)) {
                material = materials.get(i);
                break;
            }
        }
    }

    if (material != null) {
        if (material.shadingModel.equals("lambert") || material.shadingModel.equals("phong")) {
            PhongMaterial phong = new PhongMaterial();
            o.setColor(material.properties.diffuseColor);
            phong.setAmbientColor(material.properties.ambientColor);
            phong.setAmbientIntensity(material.properties.ambientFactor);
            if (material.properties.specularColor != null)
                phong.setSpecularColor(material.properties.specularColor);
            if (material.properties.shininess != null)
                phong.setShininess(material.properties.shininess);
            mat = phong;
        } else {
            DiffuseMaterial diffuse = new DiffuseMaterial();
            o.setColor(material.properties.diffuseColor);
            diffuse.setAmbientColor(material.properties.ambientColor);
            diffuse.setAmbientIntensity(material.properties.ambientFactor);
            mat = diffuse;
        }
    }

    return mat;
}
 
開發者ID:BitMastro,項目名稱:PortalLW,代碼行數:48,代碼來源:FBXParser.java

示例2: getMaterialForMesh

import rajawali.parser.fbx.FBXValues.Connections.Connect; //導入依賴的package包/類
private Material getMaterialForMesh(Object3D o, String name) {
	Material mat = new Material();
	FBXMaterial material = null;
	Stack<Connect> conns = mFbx.connections.connections;
	int num = conns.size();
	String materialName = null;
	
	for(int i=0; i<num; ++i) {
		if(conns.get(i).object2.equals(name)) {
			materialName = conns.get(i).object1;
			break;
		}
	}
	
	if(materialName != null) {
		Stack<FBXMaterial> materials = mFbx.objects.materials;
		num = materials.size();
		for(int i=0; i<num; ++i) {
			if(materials.get(i).name.equals(materialName)) {
				material = materials.get(i);
				break;
			}
		}
	}
	
	if(material != null) {
		mat.setDiffuseMethod(new DiffuseMethod.Lambert());
		mat.enableLighting(true);
		Vector3 color = material.properties.diffuseColor;
		mat.setColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		color = material.properties.ambientColor;
		mat.setAmbientColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		float intensity = material.properties.ambientFactor.floatValue();
		mat.setAmbientIntensity(intensity, intensity, intensity);

		if(material.shadingModel.equals("phong"))
		{
			SpecularMethod.Phong method = new SpecularMethod.Phong();
			if(material.properties.specularColor != null)
			{
				color = material.properties.specularColor;
				method.setSpecularColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
			}
			if(material.properties.shininess != null)
				method.setShininess(material.properties.shininess);
		}
	}
	
	return mat;
}
 
開發者ID:takyonxxx,項目名稱:IRobot-Android,代碼行數:51,代碼來源:LoaderFBX.java

示例3: getMaterialForMesh

import rajawali.parser.fbx.FBXValues.Connections.Connect; //導入依賴的package包/類
private AMaterial getMaterialForMesh(BaseObject3D o, String name) {
	AMaterial mat = new SimpleMaterial();
	Material material = null;
	Stack<Connect> conns = mFbx.connections.connections;
	int num = conns.size();
	String materialName = null;
	
	for(int i=0; i<num; ++i) {
		if(conns.get(i).object2.equals(name)) {
			materialName = conns.get(i).object1;
			break;
		}
	}
	
	if(materialName != null) {
		Stack<Material> materials = mFbx.objects.materials;
		num = materials.size();
		for(int i=0; i<num; ++i) {
			if(materials.get(i).name.equals(materialName)) {
				material = materials.get(i);
				break;
			}
		}
	}
	
	if(material != null) {
		if(material.shadingModel.equals("lambert") || material.shadingModel.equals("phong")) {
			PhongMaterial phong = new PhongMaterial();
			o.setColor(material.properties.diffuseColor);
			phong.setAmbientColor(material.properties.ambientColor);
			phong.setAmbientIntensity(material.properties.ambientFactor);
			if(material.properties.specularColor != null)
				phong.setSpecularColor(material.properties.specularColor);
			if(material.properties.shininess != null)
				phong.setShininess(material.properties.shininess);
			mat = phong;
		} else {
			DiffuseMaterial diffuse = new DiffuseMaterial();
			o.setColor(material.properties.diffuseColor);
			diffuse.setAmbientColor(material.properties.ambientColor);
			diffuse.setAmbientIntensity(material.properties.ambientFactor);
			mat = diffuse;
		}
	}
	
	return mat;
}
 
開發者ID:OpsLabJPL,項目名稱:MarsImagesAndroid,代碼行數:48,代碼來源:FBXParser.java


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