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


Java DirectionalLight.setColor方法代码示例

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


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

示例1: initScene

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
@Override
protected void initScene() {
    try {
        mLight = new DirectionalLight(0.1f, -1.0f, -1.0f);
        mLight.setColor(1.0f, 1.0f, 1.0f);
        mLight.setPower(1);
        getCurrentScene().addLight(mLight);

        mContainer = new Object3D();
        showMaskModel();
        getCurrentScene().addChild(mContainer);

    } catch (Exception e) {
        e.printStackTrace();
    }

    getCurrentScene().setBackgroundColor(0);
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:19,代码来源:ARMaskFragment.java

示例2: initScene

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
@Override
protected void initScene() {
    // Create a quad covering the whole background and assign a texture to it where the
    // Tango color camera contents will be rendered.
    ScreenQuad backgroundQuad = new ScreenQuad();
    Material tangoCameraMaterial = new Material();
    tangoCameraMaterial.setColorInfluence(0);
    // We need to use Rajawali's {@code StreamingTexture} since it sets up the texture
    // for GL_TEXTURE_EXTERNAL_OES rendering
    mTangoCameraTexture =
            new StreamingTexture("camera", (StreamingTexture.ISurfaceListener) null);
    try {
        tangoCameraMaterial.addTexture(mTangoCameraTexture);
        backgroundQuad.setMaterial(tangoCameraMaterial);
    } catch (ATexture.TextureException e) {
        Log.e(TAG, "Exception creating texture for RGB camera contents", e);
    }
    getCurrentScene().addChildAt(backgroundQuad, 0);

    // Add a directional light in an arbitrary direction.
    DirectionalLight light = new DirectionalLight(1, 0.2, -1);
    light.setColor(1, 1, 1);
    light.setPower(0.8f);
    light.setPosition(3, 2, 4);
    getCurrentScene().addLight(light);

    blue = new Material();
    blue.setColor(Color.BLUE);

    floorPlan = new FloorPlan(data);
    getCurrentScene().addChild(floorPlan);
    floorPlan.setVisible(renderVirtualObjects);

}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:35,代码来源:SceneRenderer.java

示例3: initScene

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
@Override
protected void initScene() {
    // Remember to call super.initScene() to allow TangoRajawaliArRenderer to set-up
    super.initScene();

    // Add a directional light in an arbitrary direction
    DirectionalLight light = new DirectionalLight(1, 0.2, -1);
    light.setColor(1, 1, 1);
    light.setPower(0.8f);
    light.setPosition(3, 2, 4);
    getCurrentScene().addLight(light);

    // Set-up a material: green with application of the light and instructions
    Material material = new Material();
    material.setColor(0xff009900);
    try {
        Texture t = new Texture("instructions", R.drawable.instructions);
        material.addTexture(t);
    } catch (ATexture.TextureException e) {
        e.printStackTrace();
    }
    material.setColorInfluence(0.1f);
    material.enableLighting(true);
    material.setDiffuseMethod(new DiffuseMethod.Lambert());

    // Build a Cube and place it initially in the origin
    mObject = new Cube(CUBE_SIDE_LENGTH);
    mObject.setMaterial(material);
    mObject.setPosition(0, 0, -3);
    mObject.setRotation(Vector3.Axis.Z, 180);
    getCurrentScene().addChild(mObject);
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:33,代码来源:AugmentedRealityRenderer.java

示例4: initScene

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
@Override
        protected void initScene() {
            try {
                mLight = new DirectionalLight(0.1f, -1.0f, -1.0f);
                mLight.setColor(1.0f, 1.0f, 1.0f);
                mLight.setPower(1);
                getCurrentScene().addLight(mLight);

                final LoaderAWD parser = new LoaderAWD(mContext.getResources(), mTextureManager, R.raw.head_object_new);
                parser.parse();
                mMonkey = parser.getParsedObject();
                mMonkey.setScale(0.005f);
                //mMonkey.setZ(-2f);
//                getCurrentScene().addChild(mMonkey);

                int[] resourceIds = new int[]{R.drawable.posx, R.drawable.negx,
                        R.drawable.posy, R.drawable.negy, R.drawable.posz,
                        R.drawable.negz};

                Material material = new Material();
                material.enableLighting(true);
                material.setDiffuseMethod(new DiffuseMethod.Lambert());

                CubeMapTexture envMap = new CubeMapTexture("environmentMap",
                        resourceIds);
                envMap.isEnvironmentTexture(true);
                material.addTexture(envMap);
                material.setColorInfluence(0);
                mMonkey.setMaterial(material);

                LoaderOBJ objParser1 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.glasses_obj);
                objParser1.parse();
                mGlasses = objParser1.getParsedObject();
                mGlasses.setScale(0.005f);
                //mGlasses.setZ(-0.2f);
                mGlasses.setZ(0.3f);
                mGlasses.rotate(Vector3.Axis.X, -90.0f);

                LoaderOBJ objParser2 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.hair_band_obj);
                objParser2.parse();
                mHairBand = objParser2.getParsedObject();
                mHairBand.setScale(0.006f);
                mHairBand.setY(0.27f);
                mHairBand.setZ(-0.25f);
                mHairBand.rotate(Vector3.Axis.X, -90.0f);

                LoaderOBJ objParser3 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.moustache_obj);
                objParser3.parse();
                mMoustache = objParser3.getParsedObject();
                mMoustache.setScale(0.007f);
                mMoustache.setY(-0.25f);
                mMoustache.setZ(0.3f);
                mMoustache.rotate(Vector3.Axis.X, -90.0f);

                mContainer = new Object3D();
                mContainer.addChild(mMonkey);
                mContainer.addChild(mGlasses);
                mContainer.addChild(mHairBand);
                mContainer.addChild(mMoustache);
                getCurrentScene().addChild(mContainer);
                //getCurrentCamera().setZ(20);

            } catch (Exception e) {
                e.printStackTrace();
            }

            // -- set the background color to be transparent
            // you need to have called setGLBackgroundTransparent(true); in the activity
            // for this to work.
            getCurrentScene().setBackgroundColor(0);
        }
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:72,代码来源:CameraConnectionFragment.java

示例5: buildLight

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
private ALight buildLight(Model l){
	int m = l.properties.lightType != null ? l.properties.lightType:ALight.POINT_LIGHT;
	switch (m){
	
	case ALight.POINT_LIGHT:		//Point
		PointLight light = new PointLight();
		light.setPosition(l.properties.lclTranslation);
		light.setX(light.getX() * -1f);
		light.setRotation(l.properties.lclRotation);
		light.setPower(l.properties.intensity / 100f);
		light.setColor(l.properties.color);
		// TODO add to scene
		//mRootObject.addLight(light);
		return light;			
		
	case ALight.DIRECTIONAL_LIGHT:		//Area
		DirectionalLight lD = new DirectionalLight();  //TODO calculate direction based on position and rotation
		lD.setPosition(l.properties.lclTranslation);
		lD.setX(lD.getX() * -1f);
		lD.setRotation(l.properties.lclRotation);
		lD.setPower(l.properties.intensity / 100f);
		lD.setColor(l.properties.color);
		// TODO add to scene
		//mRootObject.addLight(lD);
		return lD;
		
	default:
	case ALight.SPOT_LIGHT:		//Spot
		SpotLight lS = new SpotLight();		//TODO calculate direction based on position and rotation
		lS.setPosition(l.properties.lclTranslation);
		lS.setX(lS.getX() * -1f);
		lS.setRotation(l.properties.lclRotation);
		lS.setPower(l.properties.intensity / 100f);
		lS.setCutoffAngle(l.properties.coneangle);
		lS.setColor(l.properties.color);
		lS.setLookAt(0, 0, 0);
		// TODO add to scene
		//mRootObject.addLight(lS);			
		return lS;
	}

}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:43,代码来源:LoaderFBX.java

示例6: buildLight

import org.rajawali3d.lights.DirectionalLight; //导入方法依赖的package包/类
private ALight buildLight(Model l){
	int m = l.properties.lightType != null ? l.properties.lightType:ALight.POINT_LIGHT;
	switch (m){

	case ALight.POINT_LIGHT:		//Point
		PointLight light = new PointLight();
		light.setPosition(l.properties.lclTranslation);
		light.setX(light.getX() * -1f);
		light.setRotation(l.properties.lclRotation);
		light.setPower(l.properties.intensity / 100f);
		light.setColor(l.properties.color);
		// TODO add to scene
		//mRootObject.addLight(light);
		return light;

	case ALight.DIRECTIONAL_LIGHT:		//Area
		DirectionalLight lD = new DirectionalLight();  //TODO calculate direction based on position and rotation
		lD.setPosition(l.properties.lclTranslation);
		lD.setX(lD.getX() * -1f);
		lD.setRotation(l.properties.lclRotation);
		lD.setPower(l.properties.intensity / 100f);
		lD.setColor(l.properties.color);
		// TODO add to scene
		//mRootObject.addLight(lD);
		return lD;

	default:
	case ALight.SPOT_LIGHT:		//Spot
		SpotLight lS = new SpotLight();		//TODO calculate direction based on position and rotation
		lS.setPosition(l.properties.lclTranslation);
		lS.setX(lS.getX() * -1f);
		lS.setRotation(l.properties.lclRotation);
		lS.setPower(l.properties.intensity / 100f);
		lS.setCutoffAngle(l.properties.coneangle);
		lS.setColor(l.properties.color);
		lS.setLookAt(0, 0, 0);
		// TODO add to scene
		//mRootObject.addLight(lS);
		return lS;
	}

}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:43,代码来源:LoaderFBX.java


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