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


Java Environment.get方法代碼示例

本文整理匯總了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;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:9,代碼來源:ShaderUtils.java

示例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;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:66,代碼來源:LightComponentJson.java

示例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;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:61,代碼來源:ShaderUtils.java

示例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;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:5,代碼來源:ShaderUtils.java

示例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;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:5,代碼來源:ShaderUtils.java


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