当前位置: 首页>>代码示例>>Java>>正文


Java Material.get方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.Material.get方法的典型用法代码示例。如果您正苦于以下问题:Java Material.get方法的具体用法?Java Material.get怎么用?Java Material.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g3d.Material的用法示例。


在下文中一共展示了Material.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AreaDisplayable

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public AreaDisplayable(Model model) {
  instance = new ModelInstance(model);

  animationController = new AnimationController(instance);

  instance.transform.rotate(new Vector3(1, 0, 0), 90);

  for (Material material : instance.materials) {
    TextureAttribute ta
        = (TextureAttribute) material.get(TextureAttribute.Diffuse);

    ta.textureDescription.magFilter = Texture.TextureFilter.Nearest;
    ta.textureDescription.minFilter = Texture.TextureFilter.Nearest;

    material.set(ta);
    material.set(ColorAttribute.createDiffuse(Color.WHITE));

    BlendingAttribute ba = new BlendingAttribute(GL20.GL_SRC_ALPHA,
                                                 GL20.GL_ONE_MINUS_SRC_ALPHA);

    material.set(ba);
  }
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:24,代码来源:AreaDisplayable.java

示例2: LedEntity

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public LedEntity(Model model) {
  super(model);

  light = new PointLight();
  light.set(new Color(1f,1f, 1f, 1f), Vector3.Zero, 2f);

  for (Material material : instance.materials) {

    if (material.id.contains("Led")) {
      this.colorAttr = (ColorAttribute)material.get(ColorAttribute.Diffuse);
      colorAttr.color.set(Color.WHITE);

      this.blendingAttribute = (BlendingAttribute)material.get(BlendingAttribute.Type);
      blendingAttribute.opacity = 1.0f;
      blendingAttribute.sourceFunction = GL20.GL_ONE;
      blendingAttribute.destFunction = GL20.GL_SRC_ALPHA;

    }
  }
}
 
开发者ID:macbury,项目名称:BotLogic,代码行数:21,代码来源:LedEntity.java

示例3: loadSync

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
@Override
public Model loadSync(AssetManager manager, String fileName, FileHandle file, P parameters) {
    ModelData data = null;
    synchronized (items) {
        for (int i = 0; i < items.size; i++) {
            if (items.get(i).key.equals(fileName)) {
                data = items.get(i).value;
                items.removeIndex(i);
            }
        }
    }
    if (data == null) return null;
    final Model result = new Model(data, new TextureProvider.AssetTextureProvider(manager));
    // need to remove the textures from the managed disposables, or else ref counting
    // doesn't work!
    Iterator<Disposable> disposables = result.getManagedDisposables().iterator();
    while (disposables.hasNext()) {
        Disposable disposable = disposables.next();
        if (disposable instanceof Texture) {
            disposables.remove();
        }
    }

    // Automatically convert all materials to PBR
    for (Material material : result.materials) {
        TextureAttribute textureAttribute = (TextureAttribute) material.get(TextureAttribute.Diffuse);

        if (textureAttribute != null) {
            material.set(PbrTextureAttribute.createAlbedo(textureAttribute.textureDescription.texture));
        }
    }

    data = null;
    return result;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:36,代码来源:NhgModelLoader.java

示例4: getDefaultColors

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void getDefaultColors() {
    for (Material m : modelInstance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            originalColors.put(m.id, new Color(attribute.color));
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:9,代码来源:Entity.java

示例5: applyColorFunc

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void applyColorFunc(Consumer<Color> function) {
//        logger.debug("Color function for '{}'", name);

        for (Material m : modelInstance.materials) {
            ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
            if (attribute != null) {
                function.accept(attribute.color);
            }
        }
    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:11,代码来源:Entity.java

示例6: setColor

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void setColor(float r, float g, float b, float a, boolean newDefaults) {
//        logger.debug("New color for '{}'", name);

        for (Material m : modelInstance.materials) {
            ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
            if (attribute != null) {
                attribute.color.set(r, g, b, a);
                if (newDefaults) {
                    originalColors.get(m.id).set(r, g, b, a);
                }
            }
        }
    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:14,代码来源:Entity.java

示例7: restoreColors

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void restoreColors() {
    for (Material m : modelInstance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            attribute.color.set(originalColors.get(m.id));
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:9,代码来源:Entity.java

示例8: getDefaultColors

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
private void getDefaultColors() {
    for (Material m : instance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            originalColors.put(m.id, new Color(attribute.color));
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:9,代码来源:WorldEntity.java

示例9: restoreColors

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void restoreColors() {
    for (Material m : instance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            attribute.color.set(originalColors.get(m.id));
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:9,代码来源:WorldEntity.java

示例10: applyColorFunc

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void applyColorFunc(Consumer<Color> function) {
    logger.debug("Color function for '{}'", name);

    for (Material m : instance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            function.accept(attribute.color);
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:11,代码来源:WorldEntity.java

示例11: setColor

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void setColor(float r, float g, float b, float a, boolean newDefaults) {
    logger.debug("New color for '{}'", name);

    for (Material m : instance.materials) {
        ColorAttribute attribute = (ColorAttribute) m.get(ColorAttribute.Diffuse);
        if (attribute != null) {
            attribute.color.set(r, g, b, a);
            if (newDefaults) {
                originalColors.get(m.id).set(r, g, b, a);
            }
        }
    }
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:14,代码来源:WorldEntity.java

示例12: setColor

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void setColor (float r, float g, float b, float a) {
	color.set(r, g, b, a);
	if (modelInstance != null) {
		for (Material m : modelInstance.materials) {
			ColorAttribute ca = (ColorAttribute)m.get(ColorAttribute.Diffuse);
			if (ca != null) ca.color.set(r, g, b, a);
		}
	}
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:10,代码来源:BaseEntity.java

示例13: updateOpacity

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public void updateOpacity(float opacity) {
  for (Material material : instance.materials) {
    BlendingAttribute ba
        = (BlendingAttribute) material.get(BlendingAttribute.Type);

    ba.opacity = opacity;
  }
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:9,代码来源:ModelDisplayable.java

示例14: haveTransparency

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
public static boolean haveTransparency(Material material) {
  return material != null && material.has(BlendingAttribute.Type) && ((BlendingAttribute)material.get(BlendingAttribute.Type)).blended;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:4,代码来源:BaseRenderable.java

示例15: updateAtmosphericScatteringParams

import com.badlogic.gdx.graphics.g3d.Material; //导入方法依赖的package包/类
/**
 * Updates the atmospheric scattering shader parameters
 * 
 * @param mat
 *            The material to update.
 * @param alpha
 *            The opacity value.
 * @param ground
 *            Whether it is the ground shader or the atmosphere.
 * @param planet
 *            The planet itself, holder of this atmosphere
 */
public void updateAtmosphericScatteringParams(Material mat, float alpha, boolean ground, Planet planet) {
    Transform transform = planet.transform;
    RotationComponent rc = planet.rc;
    SceneGraphNode sol = planet.parent;
    transform.getTranslation(aux3);
    // Distance to planet
    float camHeight = (float) (aux3.len());
    float m_ESun = 15f;
    float camHeightGr = camHeight - m_fInnerRadius;
    float atmFactor = (m_fAtmosphereHeight - camHeightGr) / m_fAtmosphereHeight;

    if (!ground && camHeightGr < m_fAtmosphereHeight) {
        // Camera inside atmosphere
        m_ESun += atmFactor * 100f;
    }

    // These are here to get the desired effect inside the atmosphere
    if (mat.has(AtmosphereAttribute.KrESun))
        ((AtmosphereAttribute) mat.get(AtmosphereAttribute.KrESun)).value = m_Kr * m_ESun;
    else
        mat.set(new AtmosphereAttribute(AtmosphereAttribute.KrESun, m_Kr * m_ESun));

    if (mat.has(AtmosphereAttribute.KmESun))
        ((AtmosphereAttribute) mat.get(AtmosphereAttribute.KmESun)).value = m_Km * m_ESun;
    else
        mat.set(new AtmosphereAttribute(AtmosphereAttribute.KmESun, m_Km * m_ESun));

    // Camera height
    if (mat.has(AtmosphereAttribute.CameraHeight))
        ((AtmosphereAttribute) mat.get(AtmosphereAttribute.CameraHeight)).value = camHeight;
    else
        mat.set(new AtmosphereAttribute(AtmosphereAttribute.CameraHeight, camHeight));

    // Camera height **2
    ((AtmosphereAttribute) mat.get(AtmosphereAttribute.CameraHeight2)).value = camHeight * camHeight;

    // Earth position
    if (ground) {
        // Camera position must be corrected using the rotation angle of the planet
        aux3.rotate(rc.ascendingNode, 0, 1, 0).rotate(-rc.inclination - rc.axialTilt, 0, 0, 1).rotate(-rc.angle, 0, 1, 0);
    }
    ((Vector3Attribute) mat.get(Vector3Attribute.PlanetPos)).value.set(aux3.valuesf());
    // CameraPos = -EarthPos
    aux3.scl(-1f);

    ((Vector3Attribute) mat.get(Vector3Attribute.CameraPos)).value.set(aux3.valuesf());

    // Light position respect the earth: LightPos = SunPos - EarthPos
    sol.transform.addTranslationTo(aux3).nor();
    if (ground) {
        // Camera position must be corrected using the rotation angle of the planet
        aux3.rotate(rc.ascendingNode, 0, 1, 0).rotate(-rc.inclination - rc.axialTilt, 0, 0, 1).rotate(-rc.angle, 0, 1, 0);
    }
    ((Vector3Attribute) mat.get(Vector3Attribute.LightPos)).value.set(aux3.valuesf());

    // Alpha value
    ((AtmosphereAttribute) mat.get(AtmosphereAttribute.Alpha)).value = alpha;
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:71,代码来源:AtmosphereComponent.java


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