本文整理匯總了Java中com.badlogic.gdx.graphics.g3d.Environment.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Environment.get方法的具體用法?Java Environment.get怎麽用?Java Environment.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g3d.Environment
的用法示例。
在下文中一共展示了Environment.get方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: useImageBasedLighting
import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
public static boolean useImageBasedLighting(Environment environment) {
boolean res;
IBLAttribute iblAttribute = (IBLAttribute) environment.get(IBLAttribute.IrradianceType);
res = iblAttribute != null && iblAttribute.textureDescription != null;
return res;
}
示例2: parse
import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
@Override
public void parse(JsonValue jsonValue) {
RenderingSystem renderingSystem = nhg.entities.getEntitySystem(RenderingSystem.class);
LightComponent lightComponent = nhg.entities.createComponent(entity, LightComponent.class);
LightType lightType = LightType.fromString(jsonValue.getString("lightType"));
float range = jsonValue.getFloat("range", 1f);
float intensity = jsonValue.getFloat("intensity", 1f);
float innerAngle = jsonValue.getFloat("innerAngle", 0f);
float outerAngle = jsonValue.getFloat("outerAngle", 0f);
if (innerAngle > outerAngle) {
innerAngle = outerAngle;
}
if (range < 1.0f) {
range = 1.0f;
}
JsonValue colorJson = jsonValue.get("color");
Color color = new Color(colorJson.getFloat("r"), colorJson.getFloat("g"), colorJson.getFloat("b"), colorJson.getFloat("a"));
/*JsonValue directionJson = jsonValue.get("direction");
Vector3 direction = VectorPool.getVector3();
if (directionJson != null) {
direction.set(
directionJson.getFloat("x"),
directionJson.getFloat("y"),
directionJson.getFloat("z"));
}*/
NhgLight light = null;
switch (lightType) {
case DIRECTIONAL_LIGHT:
light = NhgLight.directional(intensity, color);
break;
case POINT_LIGHT:
light = NhgLight.point(intensity, range, color);
break;
case SPOT_LIGHT:
light = NhgLight.spot(intensity, range, innerAngle, outerAngle, color);
break;
}
if (light == null) return;
Environment environment = renderingSystem.getEnvironment();
NhgLightsAttribute attribute = (NhgLightsAttribute) environment
.get(NhgLightsAttribute.Type);
if (attribute == null) {
attribute = new NhgLightsAttribute();
environment.set(attribute);
}
attribute.lights.add(light);
lightComponent.light = light;
lightComponent.type = lightType;
output = lightComponent;
}
示例3: createPrefix
import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
public static String createPrefix(Renderable renderable, boolean skinned) {
String prefix = "";
final int n = renderable.meshPart.mesh.getVertexAttributes().size();
for (int i = 0; i < n; i++) {
final VertexAttribute attr = renderable.meshPart.mesh.getVertexAttributes().get(i);
if (attr.usage == VertexAttributes.Usage.BoneWeight) {
prefix += "#define boneWeight" + attr.unit + "Flag\n";
}
}
if (skinned) {
prefix += "#define skinningFlag\n";
}
Environment environment = renderable.environment;
// Ambient lighting
ColorAttribute ambientLightAttribute = (ColorAttribute) environment.get(ColorAttribute.AmbientLight);
if (ambientLightAttribute != null) {
prefix += "#define ambientLighting\n";
}
// Directional lighting
DirectionalLightsAttribute directionalLightsAttribute = (DirectionalLightsAttribute) environment.get(DirectionalLightsAttribute.Type);
if (directionalLightsAttribute != null) {
Array<DirectionalLight> directionalLights = directionalLightsAttribute.lights;
if (directionalLights.size > 0) {
prefix += "#define numDirectionalLights " + directionalLights.size + "\n";
}
}
// Point lighting
PointLightsAttribute pointLightsAttribute = (PointLightsAttribute) environment.get(PointLightsAttribute.Type);
if (pointLightsAttribute != null) {
Array<PointLight> pointLights = pointLightsAttribute.lights;
if (pointLights.size > 0) {
prefix += "#define numPointLights " + pointLights.size + "\n";
}
}
// Spot lighting
SpotLightsAttribute spotLightsAttribute = (SpotLightsAttribute) environment.get(SpotLightsAttribute.Type);
if (spotLightsAttribute != null) {
Array<SpotLight> spotLights = spotLightsAttribute.lights;
if (spotLights.size > 0) {
prefix += "#define numSpotLights " + spotLights.size + "\n";
}
}
return prefix;
}
示例4: hasLights
import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
public static boolean hasLights(Environment environment) {
NhgLightsAttribute lightsAttribute = (NhgLightsAttribute) environment.get(NhgLightsAttribute.Type);
return lightsAttribute != null && lightsAttribute.lights.size > 0;
}
示例5: useGammaCorrection
import com.badlogic.gdx.graphics.g3d.Environment; //導入方法依賴的package包/類
public static boolean useGammaCorrection(Environment environment) {
GammaCorrectionAttribute gammaCorrectionAttribute = (GammaCorrectionAttribute) environment.get(GammaCorrectionAttribute.Type);
return gammaCorrectionAttribute == null || gammaCorrectionAttribute.gammaCorrection;
}