当前位置: 首页>>代码示例>>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;未经允许,请勿转载。