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


Java Material.setColor方法代码示例

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


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

示例1: createPhotoSphereWithTexture

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private static Sphere createPhotoSphereWithTexture(ATexture texture) {

        Material material = new Material();
        material.setColor(0);

        try {
            material.addTexture(texture);
        } catch (ATexture.TextureException e) {
            throw new RuntimeException(e);
        }

        Sphere sphere = new Sphere(50, 64, 32);
        sphere.setScaleX(-1);
        sphere.setMaterial(material);


        return sphere;
    }
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:19,代码来源:MyRenderer.java

示例2: init

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private void init() {
    this.setTransparent(true);
    this.setDoubleSided(true);

    float[] vertices = new float[MAX_VERTICES * 3];
    float[] normals = new float[MAX_VERTICES * 3];
    int[] indices = new int[MAX_VERTICES];
    for (int i = 0; i < indices.length; ++i) {
        indices[i] = i;
        int index = i * 3;
        normals[index] = 0;
        normals[index + 1] = 1;
        normals[index + 2] = 0;
    }
    setData(vertices, normals, null, null, indices, false);
    Material material = new Material();
    material.setColor(color);
    setMaterial(material);
    rebuildPoints();
    setPosition(new Vector3(0, -1.4, 0));
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:22,代码来源:FloorPlan.java

示例3: Trajectory

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
public Trajectory(int color, float thickness) {
    super();
    init(true);
    Material m = new Material();
    m.setColor(color);
    setMaterial(m);
    mVertexBuffer = ByteBuffer
            .allocateDirect(MAX_NUMBER_OF_VERTICES * Geometry3D.FLOAT_SIZE_BYTES)
            .order(ByteOrder.nativeOrder()).asFloatBuffer();

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

示例4: initScene

import org.rajawali3d.materials.Material; //导入方法依赖的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

示例5: addAxis

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private void addAxis(Vector3 direction, int color) {
    Stack<Vector3> points = new Stack<Vector3>();
    points.add(new Vector3());
    points.add(direction);
    Line3D line = new Line3D(points, mThickness);
    Material material = new Material();
    material.setColor(color);
    line.setMaterial(material);
    addChild(line);
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:11,代码来源:Axes.java

示例6: Points

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
public Points(int numberOfPoints) {
    super();
    mMaxNumberofVertices = numberOfPoints;
    init(true);
    Material m = new Material();
    m.setColor(Color.GREEN);
    setMaterial(m);
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:9,代码来源:Points.java

示例7: Trajectory

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
public Trajectory(int color, float thickness) {
    super();
    init(true);
    Material m = new Material();
    m.setColor(color);
    setMaterial(m);
    mVertexBuffer = ByteBuffer
            .allocateDirect(mMaxNumberOfVertices * Geometry3D.FLOAT_SIZE_BYTES)
            .order(ByteOrder.nativeOrder()).asFloatBuffer();

}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:12,代码来源:Trajectory.java

示例8: initScene

import org.rajawali3d.materials.Material; //导入方法依赖的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

示例9: getMaterialForMesh

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private Material getMaterialForMesh(Object3D o, String name) {
	Material mat = new Material();
	FBXMaterial material = null;
	Stack<Connect> conns = mFbx.connections.connections;
	int num = conns.size();
	String materialName = null;
	
	for(int i=0; i<num; ++i) {
		if(conns.get(i).object2.equals(name)) {
			materialName = conns.get(i).object1;
			break;
		}
	}
	
	if(materialName != null) {
		Stack<FBXMaterial> materials = mFbx.objects.materials;
		num = materials.size();
		for(int i=0; i<num; ++i) {
			if(materials.get(i).name.equals(materialName)) {
				material = materials.get(i);
				break;
			}
		}
	}
	
	if(material != null) {
		mat.setDiffuseMethod(new DiffuseMethod.Lambert());
		mat.enableLighting(true);
		Vector3 color = material.properties.diffuseColor;
		mat.setColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		color = material.properties.ambientColor;
		mat.setAmbientColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		float intensity = material.properties.ambientFactor.floatValue();
		mat.setAmbientIntensity(intensity, intensity, intensity);

		if(material.shadingModel.equals("phong"))
		{
			SpecularMethod.Phong method = new SpecularMethod.Phong();
			if(material.properties.specularColor != null)
			{
				color = material.properties.specularColor;
				method.setSpecularColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
			}
			if(material.properties.shininess != null)
				method.setShininess(material.properties.shininess);
		}
	}
	
	return mat;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:51,代码来源:LoaderFBX.java

示例10: Grid

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
public Grid(int size, int step, float thickness, int color) {
    super(calculatePoints(size, step), thickness, color);
    Material material = new Material();
    material.setColor(color);
    this.setMaterial(material);
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:7,代码来源:Grid.java

示例11: getMaterialForMesh

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private Material getMaterialForMesh(Object3D o, String name) {
	Material mat = new Material();
	FBXMaterial material = null;
	Stack<Connect> conns = mFbx.connections.connections;
	int num = conns.size();
	String materialName = null;

	for(int i=0; i<num; ++i) {
		if(conns.get(i).object2.equals(name)) {
			materialName = conns.get(i).object1;
			break;
		}
	}

	if(materialName != null) {
		Stack<FBXMaterial> materials = mFbx.objects.materials;
		num = materials.size();
		for(int i=0; i<num; ++i) {
			if(materials.get(i).name.equals(materialName)) {
				material = materials.get(i);
				break;
			}
		}
	}

	if(material != null) {
		mat.setDiffuseMethod(new DiffuseMethod.Lambert());
		mat.enableLighting(true);
		Vector3 color = material.properties.diffuseColor;
		mat.setColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		color = material.properties.ambientColor;
		mat.setAmbientColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
		float intensity = material.properties.ambientFactor.floatValue();
		mat.setAmbientIntensity(intensity, intensity, intensity);

		if(material.shadingModel.equals("phong"))
		{
			SpecularMethod.Phong method = new SpecularMethod.Phong();
			if(material.properties.specularColor != null)
			{
				color = material.properties.specularColor;
				method.setSpecularColor(Color.rgb((int)(color.x * 255.f), (int)(color.y * 255.f), (int)(color.z * 255.f)));
			}
			if(material.properties.shininess != null)
				method.setShininess(material.properties.shininess);
		}
	}

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

示例12: renderColorPicking

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
/**
 * Renders the object for color-picking
 *
 * @param camera The camera
 * @param pickingMaterial The color-picking Material
 */
public void renderColorPicking(final Camera camera, final Material pickingMaterial) {
	if (!mIsVisible && !mRenderChildrenAsBatch)
		// Neither the object nor any of its children are visible
		return;

	// Color-picking assumes much of the object state set in the prior frame is intact:
	//   No need to prerender (color-picking always runs before any children changes)
	//   All matrices already updated during prior frame
	//   Bounding box already transformed

	mIsInFrustum = true; // only if mFrustrumTest == true it check frustum
	if (mFrustumTest && mGeometry.hasBoundingBox()) {
		BoundingBox bbox = mGeometry.getBoundingBox();
		if (!camera.getFrustum().boundsInFrustum(bbox)) {
			mIsInFrustum = false;
		}
	}

	// Render this object only if it has visible geometry and didn't fail frustum test
	if (!mIsContainerOnly && mIsInFrustum && mIsVisible) {
		// Render same faces as visible render
		if (mDoubleSided) {
			GLES20.glDisable(GLES20.GL_CULL_FACE);
		} else {
			GLES20.glEnable(GLES20.GL_CULL_FACE);
			if (mBackSided) {
				GLES20.glCullFace(GLES20.GL_FRONT);
			} else {
				GLES20.glCullFace(GLES20.GL_BACK);
				GLES20.glFrontFace(GLES20.GL_CCW);
			}
		}

		// Blending and depth testing are set up globally in Scene.doColorPicking()

		// Material setup is independent of batching, and has no need for
		// shader params, textures, normals, vertex colors, or current object...
		pickingMaterial.useProgram();
		pickingMaterial.setVertices(mGeometry.getVertexBufferInfo());
		pickingMaterial.setColor(mPickingColor);
		pickingMaterial.applyParams();

		// Unbind the array buffer
		GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

		// Apply this object's matrices to the pickingMaterial
		pickingMaterial.setMVPMatrix(mMVPMatrix);
		pickingMaterial.setModelMatrix(mMMatrix);
		pickingMaterial.setModelViewMatrix(mMVMatrix);

		// Draw the object using its picking color
		int bufferType = mGeometry.getIndexBufferInfo().bufferType == Geometry3D.BufferType.SHORT_BUFFER ? GLES20.GL_UNSIGNED_SHORT : GLES20.GL_UNSIGNED_INT;
		GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, mGeometry.getIndexBufferInfo().bufferHandle);
		GLES20.glDrawElements(mDrawingMode, mGeometry.getNumIndices(), bufferType, 0);
		GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);

		// Only need to undo face culling
		if (mDoubleSided) {
			GLES20.glEnable(GLES20.GL_CULL_FACE);
		} else if (mBackSided) {
			GLES20.glCullFace(GLES20.GL_BACK);
		}
	}

	// No need to draw bounding volumes..

	// Draw children without frustum test
	for (int i = 0, j = mChildren.size(); i < j; i++) {
		// Child rendering is independent of batching, and matrices already updated
		mChildren.get(i).renderColorPicking(camera, pickingMaterial);
	}

	// No textures to unbind, all done
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:81,代码来源:Object3D.java

示例13: makeFixedObjects

import org.rajawali3d.materials.Material; //导入方法依赖的package包/类
private void makeFixedObjects() {
        try {
            // Make fixed objects
            Object3D obj = null;
            LoaderOBJ loader = new LoaderOBJ(mContext.getResources(),
                    mRenderer.getTextureManager(), R.raw.destroyer_obj);
            loader.parse();
            obj = loader.getParsedObject();
            obj.enableLookAt();
            obj.setScale(20f);

            Material objMaterial = new Material();
            objMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
            //objMaterial.setColorInfluence(0);
            objMaterial.enableLighting(true);
            objMaterial.setColor(0xff444444);

            obj.setMaterial(objMaterial);
            mRenderer.getCurrentScene().addChild(obj);

//            LoaderAWD loader = new LoaderAWD(mContext.getResources(), mRenderer.getTextureManager(),
//                    R.raw.space_cruiser);
//            loader.parse();
//
//            Material cruiserMaterial = new Material();
//            cruiserMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
//            cruiserMaterial.setColorInfluence(0);
//            cruiserMaterial.enableLighting(true);
//            cruiserMaterial.addTexture(new Texture("spaceCruiserTex", R.drawable.space_cruiser_4_color_1));
//
//            Object3D obj = loader.getParsedObject();
//            obj.setMaterial(cruiserMaterial);
//            obj.setScale(10);
//            obj.setZ(-6);
//            obj.setY(1);
//            mRenderer.getCurrentScene().addChild(obj);

            mDestroyer = new Destroyer(obj);
            mDestroyer.initBoundingBox();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:44,代码来源:World.java


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