• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DirectionalLight类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DirectionalLight类属于org.rajawali3d.lights包,在下文中一共展示了DirectionalLight类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: createLightViewProjectionMatrix

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
private Matrix4 createLightViewProjectionMatrix(DirectionalLight light) {
	//
	// -- Get the frustum corners in world space
	//
	mCamera.getFrustumCorners(mFrustumCorners, true);
	//
	// -- Get the frustum centroid
	//
	mFrustumCentroid.setAll(0, 0, 0);
	for(int i=0; i<8; i++)
		mFrustumCentroid.add(mFrustumCorners[i]);
	mFrustumCentroid.divide(8.0);
	
	//
	// -- 
	//
	
	BoundingBox lightBox = new BoundingBox(mFrustumCorners);
	double distance = mFrustumCentroid.distanceTo(lightBox.getMin());
	Vector3 lightDirection = light.getDirectionVector().clone();
	lightDirection.normalize();
	Vector3 lightPosition = Vector3.subtractAndCreate(mFrustumCentroid, Vector3.multiplyAndCreate(lightDirection, distance));
          
	//
	// -- 
	//
	
	mLightViewMatrix.setToLookAt(lightPosition, mFrustumCentroid, Vector3.Y);
	
	for(int i=0; i<8; i++)
		mFrustumCorners[i].multiply(mLightViewMatrix);
          
          BoundingBox b = new BoundingBox(mFrustumCorners);
          mLightProjectionMatrix.setToOrthographic(b.getMin().x, b.getMax().x, b.getMin().y, b.getMax().y, -b.getMax().z, -b.getMin().z);

          mLightModelViewProjectionMatrix.setAll(mLightProjectionMatrix);
          mLightModelViewProjectionMatrix.multiply(mLightViewMatrix);
	return mLightModelViewProjectionMatrix;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:40,代码来源:ShadowMapMaterial.java


示例3: ShadowPass

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowPass(ShadowPassType shadowPassType, RajawaliScene scene, Camera camera, DirectionalLight light, RenderTarget renderTarget) {
	super(scene, camera, 0);
	mShadowPassType = shadowPassType;
	mShadowRenderTarget = renderTarget;
	mShadowMapSize = renderTarget.getWidth();
	if(shadowPassType == ShadowPassType.CREATE_SHADOW_MAP) {
		mShadowMapMaterial = new ShadowMapMaterial();
		mShadowMapMaterial.setLight(light);
		mShadowMapMaterial.setCamera(camera);
		mShadowMapMaterial.setScene(scene);
		setMaterial(mShadowMapMaterial);
	}
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:14,代码来源:ShadowPass.java


示例4: ShadowEffect

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowEffect(RajawaliScene scene, Camera camera, DirectionalLight light, int shadowMapSize) {
	super();
	mScene = scene;
	mCamera = camera;
	mLight = light;
	mShadowMapSize = shadowMapSize;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:8,代码来源:ShadowEffect.java


示例5: 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


示例6: createLightViewProjectionMatrix

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
private Matrix4 createLightViewProjectionMatrix(DirectionalLight light) {
	//
	// -- Get the frustum corners in world space
	//
	mCamera.getFrustumCorners(mFrustumCorners, true);
	//
	// -- Get the frustum centroid
	//
	mFrustumCentroid.setAll(0, 0, 0);
	for(int i=0; i<8; i++)
		mFrustumCentroid.add(mFrustumCorners[i]);
	mFrustumCentroid.divide(8.0);

	//
	// --
	//

	BoundingBox lightBox = new BoundingBox(mFrustumCorners);
	double distance = mFrustumCentroid.distanceTo(lightBox.getMin());
	Vector3 lightDirection = light.getDirectionVector().clone();
	lightDirection.normalize();
	Vector3 lightPosition = Vector3.subtractAndCreate(mFrustumCentroid, Vector3.multiplyAndCreate(lightDirection, distance));

	//
	// --
	//

	mLightViewMatrix.setToLookAt(lightPosition, mFrustumCentroid, Vector3.Y);

	for(int i=0; i<8; i++)
		mFrustumCorners[i].multiply(mLightViewMatrix);

          BoundingBox b = new BoundingBox(mFrustumCorners);
          mLightProjectionMatrix.setToOrthographic(b.getMin().x, b.getMax().x, b.getMin().y, b.getMax().y, -b.getMax().z, -b.getMin().z);

          mLightModelViewProjectionMatrix.setAll(mLightProjectionMatrix);
          mLightModelViewProjectionMatrix.multiply(mLightViewMatrix);
	return mLightModelViewProjectionMatrix;
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:40,代码来源:ShadowMapMaterial.java


示例7: ShadowPass

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowPass(ShadowPassType shadowPassType, Scene scene, Camera camera, DirectionalLight light, RenderTarget renderTarget) {
	super(scene, camera, 0);
	mShadowPassType = shadowPassType;
	mShadowRenderTarget = renderTarget;
	mShadowMapSize = renderTarget.getWidth();
	if(shadowPassType == ShadowPassType.CREATE_SHADOW_MAP) {
		mShadowMapMaterial = new ShadowMapMaterial();
		mShadowMapMaterial.setLight(light);
		mShadowMapMaterial.setCamera(camera);
		mShadowMapMaterial.setScene(scene);
		setMaterial(mShadowMapMaterial);
	}
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:14,代码来源:ShadowPass.java


示例8: ShadowEffect

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowEffect(Scene scene, Camera camera, DirectionalLight light, int shadowMapSize) {
	super();
	mScene = scene;
	mCamera = camera;
	mLight = light;
	mShadowMapSize = shadowMapSize;
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:8,代码来源:ShadowEffect.java


示例9: 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


示例10: initScene

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
protected void initScene() {

        mLight = new DirectionalLight(.3f, -.3f, -1);
        mLight.setPower(1f);
        getCurrentScene().addLight(mLight);
        mLight.setPosition(-2, 1, 4);

        mPicker = new ObjectColorPicker(this);
        mPicker.setOnObjectPickedListener(this);

        ArcballCamera arcball = new ArcballCamera(mContext, ((Activity)mContext).findViewById(R.id.drawer_layout));
        arcball.setPosition(0, 0, 10);
        getCurrentScene().replaceAndSwitchCamera(getCurrentCamera(), arcball);

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

        LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.industryrobot_obj);
        try {
            objParser.parse();
            mObjectGroup = objParser.getParsedObject();
            mObjectGroup.setScale(0.0025f);
            mObjectGroup.setZ(-2);
            mObjectGroup.setY(-5);
            mPicker.registerObject(mObjectGroup);
            //getCurrentScene().addChild(mObjectGroup);
        } catch (ParsingException e) {
            e.printStackTrace();
        }

        box();

        fillBox(material);

        mObjectGroup.setMaterial(material);
    }
 
开发者ID:selop,项目名称:dynamic-perspective-on-android,代码行数:38,代码来源:CubeRoomRenderer.java


示例11: setupLight

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
@NonNull
private DirectionalLight setupLight() {
    DirectionalLight light = new DirectionalLight(0, 0.2, -10);
    light.setPower(1.4f);
    return light;
}
 
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:7,代码来源:RajawaliHeadRenderer.java


示例12: 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


示例13: initScene

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
@Override
protected void initScene() {
    try {
        DirectionalLight light = new DirectionalLight();
        light.setLookAt(0, 2, 0);
        light.enableLookAt();
        light.setPosition(0, 2, 5);
        light.setPower(1.0f);
        getCurrentScene().addLight(light);

        DebugVisualizer debugViz = new DebugVisualizer(this);
        debugViz.addChild(new GridFloor());
        debugViz.addChild(new DebugLight(light, 0x999900, 1));
        debugViz.addChild(new CoordinateTrident());
        getCurrentScene().addChild(debugViz);

        String objDir ="BuildMask" + File.separator;
        String objName = FileUtils.getMD5(mImagePath) + "_obj";
        LoaderOBJ parser = new LoaderOBJ(this, objDir + objName);
        parser.parse();
        Object3D monkey = parser.getParsedObject();
        ATexture texture = monkey.getMaterial().getTextureList().get(0);
        monkey.getMaterial().removeTexture(texture);
        monkey.setScale(0.65f);

        File sdcard = Environment.getExternalStorageDirectory();
        String textureDir = sdcard.getAbsolutePath() + File.separator + "BuildMask" + File.separator;
        String textureName = FileUtils.getMD5(mImagePath) + ".jpg";
        Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFilePath(textureDir + textureName, 1024, 1024);
        monkey.getMaterial().addTexture(new Texture("canvas", bitmap));
        monkey.getMaterial().enableLighting(false);

        getCurrentScene().addChild(monkey);

        ArcballCamera arcBall = new ArcballCamera(mContext, ((Activity)mContext).findViewById(R.id.layout_container));
        arcBall.setPosition(4, 4, 4);
        getCurrentScene().replaceAndSwitchCamera(getCurrentCamera(), arcBall);
    } catch(Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:42,代码来源:ShowMaskFragment.java


示例14: ShadowMapMaterial

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowMapMaterial(Camera camera, RajawaliScene scene, DirectionalLight light) {
	this();
	setCamera(camera);
	setScene(scene);
	setLight(light);
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:7,代码来源:ShadowMapMaterial.java


示例15: setLight

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public void setLight(DirectionalLight light) {
	((ShadowMapVertexShader)mCustomVertexShader).setLight(light);
	mLight = light;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:5,代码来源:ShadowMapMaterial.java


示例16: 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


示例17: ShadowMapMaterial

import org.rajawali3d.lights.DirectionalLight; //导入依赖的package包/类
public ShadowMapMaterial(Camera camera, Scene scene, DirectionalLight light) {
	this();
	setCamera(camera);
	setScene(scene);
	setLight(light);
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:7,代码来源:ShadowMapMaterial.java


示例18: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FIS类代码示例发布时间:2022-05-23
下一篇:
Java SAMLContextProviderLB类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap