本文整理汇总了Java中org.rajawali3d.lights.DirectionalLight.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java DirectionalLight.setPosition方法的具体用法?Java DirectionalLight.setPosition怎么用?Java DirectionalLight.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.rajawali3d.lights.DirectionalLight
的用法示例。
在下文中一共展示了DirectionalLight.setPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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();
}
}
示例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;
}
}
示例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;
}
}