本文整理汇总了Java中org.rajawali3d.materials.textures.ATexture类的典型用法代码示例。如果您正苦于以下问题:Java ATexture类的具体用法?Java ATexture怎么用?Java ATexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ATexture类属于org.rajawali3d.materials.textures包,在下文中一共展示了ATexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: bindTextures
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Binds the textures to an OpenGL texturing target. Called every frame by
* {@link RajawaliScene#render(long, double, org.rajawali3d.renderer.RenderTarget)}. Shouldn't
* be called manually.
*/
public void bindTextures() {
// Assume its the number of textures
int num = mTextureList.size();
// Check if the number of applied textures is larger than the max texture count
// - this would be due to deferred capabilities checking. If so, choose max texture count.
if (num > mMaxTextures) {
RajLog.e(num + " textures have been added to this material but this device supports a max of "
+ mMaxTextures + " textures in the fragment shader. Only the first " + mMaxTextures + " will be used.");
num = mMaxTextures;
}
for (int i = 0; i < num; i++) {
ATexture texture = mTextureList.get(i);
bindTextureByName(texture.getTextureName(), i, texture);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + i);
GLES20.glBindTexture(texture.getGLTextureType(), texture.getTextureId());
GLES20.glUniform1i(GLES20.glGetUniformLocation(mProgramHandle, texture.getTextureName()), i);
}
if (mPlugins != null)
for (IMaterialPlugin plugin : mPlugins)
plugin.bindTextures(num);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:29,代码来源:Material.java
示例2: applyParams
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
@Override
public void applyParams() {
super.applyParams();
if(mTextures == null) return;
for(int i=0; i<mTextures.size(); i++)
{
ATexture texture = mTextures.get(i);
GLES20.glUniform1f(muInfluenceHandles[i], texture.getInfluence());
if(texture.getWrapType() == WrapType.REPEAT)
GLES20.glUniform2fv(muRepeatHandles[i], 1, texture.getRepeat(), 0);
if(texture.offsetEnabled())
GLES20.glUniform2fv(muOffsetHandles[i], 1, texture.getOffset(), 0);
}
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:17,代码来源:ATextureFragmentShaderFragment.java
示例3: main
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
@Override
public void main() {
super.main();
RVec4 color = (RVec4)getGlobal(DefaultShaderVar.G_COLOR);
RVec2 textureCoord = (RVec2)getGlobal(DefaultShaderVar.G_TEXTURE_COORD);
RVec4 texColor = new RVec4("texColor");
for(int i=0; i<mTextures.size(); i++)
{
ATexture texture = mTextures.get(i);
if(texture.offsetEnabled())
textureCoord.assignAdd(getGlobal(DefaultShaderVar.U_OFFSET, i));
if(texture.getWrapType() == WrapType.REPEAT)
textureCoord.assignMultiply(getGlobal(DefaultShaderVar.U_REPEAT, i));
if(texture.getTextureType() == TextureType.VIDEO_TEXTURE)
texColor.assign(texture2D(muVideoTextures[i], textureCoord));
else
texColor.assign(texture2D(muTextures[i], textureCoord));
texColor.assignMultiply(muInfluence[i]);
color.assignAdd(texColor);
}
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:24,代码来源:DiffuseTextureFragmentShaderFragment.java
示例4: createPhotoSphereWithTexture
import org.rajawali3d.materials.textures.ATexture; //导入依赖的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
示例5: createPlayButton
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
private static Plane createPlayButton(ATexture texture){
Material playBtnM = new Material();
playBtnM.setColorInfluence(0);
try {
//place the button picture in "res/drawable-nodpi/"
playBtnM.addTexture(new Texture("playBtn", R.drawable.target));
} catch(ATexture.TextureException e) {
e.printStackTrace();
}
Plane playBtn;
playBtn = new Plane(1, 1, 8, 8);
playBtn.setScale(-1);
playBtn.setMaterial(playBtnM);
playBtn.setPosition(5, 5, -2);
playBtn.setAlpha(0);
// getCurrentScene().addChild(playBtn);
return playBtn;
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:21,代码来源:MyRenderer.java
示例6: initScene
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Sets up the initial scene with a default Rajawali camera and a background quad rendering
* the Tango camera contents.
*/
@Override
protected void initScene() {
mBackgroundQuad = new ScreenQuad();
mTangoCameraTexture =
new StreamingTexture("camera", (StreamingTexture.ISurfaceListener) null);
Material tangoCameraMaterial = new Material();
tangoCameraMaterial.setColorInfluence(0);
try {
tangoCameraMaterial.addTexture(mTangoCameraTexture);
mBackgroundQuad.setMaterial(tangoCameraMaterial);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
getCurrentScene().addChildAt(mBackgroundQuad, 0);
}
开发者ID:kupoko,项目名称:Tiresias,代码行数:22,代码来源:TangoRajawaliRenderer.java
示例7: showMaskModel
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
void showMaskModel() {
try {
if (mMonkey != null) {
mMonkey.setY(0);
mContainer.removeChild(mMonkey);
}
//String mImagePath = "/storage/emulated/0/dlib/20130821040137899.jpg";
String mImagePath = "/storage/emulated/0/BuildMask/capture_face.jpg";
String objDir ="BuildMask" + File.separator;
String objName = FileUtils.getMD5(mImagePath) + "_obj";
LoaderOBJ parser = new LoaderOBJ(this, objDir + objName);
parser.parse();
mMonkey = parser.getParsedObject();
ATexture texture = mMonkey.getMaterial().getTextureList().get(0);
mMonkey.getMaterial().removeTexture(texture);
mMonkey.setScale(0.06f);
mMonkey.setY(-0.54f);
mMonkey.setZ(0.25f);
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);
mMonkey.getMaterial().addTexture(new Texture("canvas", bitmap));
mMonkey.getMaterial().enableLighting(false);
mContainer.addChild(mMonkey);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:34,代码来源:ARMaskFragment.java
示例8: Material
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public Material(boolean deferCapabilitiesCheck) {
mCapabilitiesCheckDeferred = deferCapabilitiesCheck;
mTextureList = new ArrayList<ATexture>();
// If we have deffered the capabilities check, we have no way of knowing how many textures this material
// is capable of having. We could choose 8, the minimum required fragment shader texture unit count, but
// that would not allow us to finish construction of this material until the EGL context is available. Instead,
// we are choosing the maximum integer Java can handle, and we will print a warning if the number of added textures
// exceeds the capability once known. In this event they will be used in listed order until the max is hit.
mMaxTextures = mCapabilitiesCheckDeferred ? Integer.MAX_VALUE : Capabilities.getInstance().getMaxTextureImageUnits();
mColor = new float[]{1, 0, 0, 1};
mAmbientColor = new float[]{.2f, .2f, .2f};
mAmbientIntensity = new float[]{.3f, .3f, .3f};
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:16,代码来源:Material.java
示例9: setTextureParameters
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Sets the OpenGL texture handles for a newly added texture.
*
* @param texture
*/
private void setTextureParameters(ATexture texture) {
if (texture.getUniformHandle() > -1) return;
int textureHandle = GLES20.glGetUniformLocation(mProgramHandle, texture.getTextureName());
if (textureHandle == -1) {
RajLog.d("Could not get attrib location for "
+ texture.getTextureName() + ", " + texture.getTextureType());
}
texture.setUniformHandle(textureHandle);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:16,代码来源:Material.java
示例10: unbindTextures
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Unbinds the texture from an OpenGL texturing target.
*/
public void unbindTextures() {
int num = mTextureList.size();
if (mPlugins != null)
for (IMaterialPlugin plugin : mPlugins)
plugin.unbindTextures();
for (int i = 0; i < num; i++) {
ATexture texture = mTextureList.get(i);
GLES20.glBindTexture(texture.getGLTextureType(), 0);
}
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:18,代码来源:Material.java
示例11: addTexture
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Adds a texture to this material. Throws and error if the maximum number of textures was reached.
*
* @param texture
*
* @throws TextureException
*/
public void addTexture(ATexture texture) throws TextureException {
if (mTextureList.indexOf(texture) > -1) return;
if (mTextureList.size() + 1 > mMaxTextures) {
throw new TextureException("Maximum number of textures for this material has been reached. Maximum number of textures is " + mMaxTextures + ".");
}
mTextureList.add(texture);
TextureManager.getInstance().addTexture(texture);
texture.registerMaterial(this);
mIsDirty = true;
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:20,代码来源:Material.java
示例12: PhongFragmentShaderFragment
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public PhongFragmentShaderFragment(List<ALight> lights, int specularColor, float shininess, float specularIntensity, List<ATexture> textures) {
super(textures);
mSpecularColor = new float[] { 1, 1, 1 };
mSpecularColor[0] = (float)Color.red(specularColor) / 255.f;
mSpecularColor[1] = (float)Color.green(specularColor) / 255.f;
mSpecularColor[2] = (float)Color.blue(specularColor) / 255.f;
mShininess = shininess;
mSpecularIntensity = specularIntensity;
mLights = lights;
mTextures = textures;
initialize();
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:13,代码来源:PhongFragmentShaderFragment.java
示例13: setLocations
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
@Override
public void setLocations(int programHandle) {
if(mTextures == null) return;
for(int i=0; i<mTextures.size(); i++)
{
ATexture texture = mTextures.get(i);
muTextureHandles[i] = getUniformLocation(programHandle, texture.getTextureName());
muInfluenceHandles[i] = getUniformLocation(programHandle, DefaultShaderVar.U_INFLUENCE, texture.getTextureName());
if(texture.getWrapType() == WrapType.REPEAT)
muRepeatHandles[i] = getUniformLocation(programHandle, DefaultShaderVar.U_REPEAT, i);
if(texture.offsetEnabled())
muOffsetHandles[i] = getUniformLocation(programHandle, DefaultShaderVar.U_OFFSET, i);
}
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:15,代码来源:ATextureFragmentShaderFragment.java
示例14: addTexture
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public boolean addTexture(final ATexture texture) {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mTextureManager.taskAdd(texture);
}
};
return internalOfferTask(task);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:10,代码来源:RajawaliRenderer.java
示例15: removeTexture
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public boolean removeTexture(final ATexture texture) {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mTextureManager.taskRemove(texture);
}
};
return internalOfferTask(task);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:10,代码来源:RajawaliRenderer.java
示例16: replaceTexture
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public boolean replaceTexture(final ATexture texture) {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
mTextureManager.taskReplace(texture);
}
};
return internalOfferTask(task);
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:10,代码来源:RajawaliRenderer.java
示例17: initScene
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
@Override
protected void initScene() {
mMediaPlayer = MediaPlayer.create(getContext(), R.raw.test);
//mMediaPlayer = MediaPlayer.create(getContext(), Uri.parse("http://nepal.cloudapp.net/video_portal/video.mp4"));
mMediaPlayer.setLooping(true);
mVideoTexture = new StreamingTexture("sintelTrailer", mMediaPlayer);
Log.d("TextureSet","Texture");
Material material = new Material();
material.setColorInfluence(0);
try {
material.addTexture(mVideoTexture);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
Sphere sphere = new Sphere(50, 64, 32);
sphere.setScaleX(-1);
sphere.setMaterial(material);
getCurrentScene().addChild(sphere);
getCurrentCamera().setPosition(Vector3.ZERO);
getCurrentCamera().setFieldOfView(75);
EllipticalOrbitAnimation3D camAnim = new EllipticalOrbitAnimation3D(
new Vector3(3, 2, 10), new Vector3(1, 0, 8), 0, 359);
camAnim.setDurationMilliseconds(20000);
camAnim.setRepeatMode(Animation.RepeatMode.INFINITE);
camAnim.setTransformable3D(getCurrentCamera());
getCurrentScene().registerAnimation(camAnim);
camAnim.play();
mMediaPlayer.start();
}
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:41,代码来源:VideoPlayer.java
示例18: initScene
import org.rajawali3d.materials.textures.ATexture; //导入依赖的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
示例19: setTextureParameters
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
/**
* Sets the OpenGL texture handles for a newly added texture.
*
* @param texture
*/
private void setTextureParameters(ATexture texture) {
if (mTextureHandles.containsKey(texture.getTextureName())) return;
int textureHandle = GLES20.glGetUniformLocation(mProgramHandle, texture.getTextureName());
if (textureHandle == -1 && RajLog.isDebugEnabled()) {
RajLog.e("Could not get uniform location for " + texture.getTextureName() + ", "
+ texture.getTextureType());
return;
}
mTextureHandles.put(texture.getTextureName(), textureHandle);
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:17,代码来源:Material.java
示例20: bindTextureByName
import org.rajawali3d.materials.textures.ATexture; //导入依赖的package包/类
public void bindTextureByName(int index, ATexture texture) {
if (!mTextureHandles.containsKey(texture.getTextureName())) {
setTextureParameters(texture);
}
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + index);
GLES20.glBindTexture(texture.getGLTextureType(), texture.getTextureId());
GLES20.glUniform1i(mTextureHandles.get(texture.getTextureName()), index);
}
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:9,代码来源:Material.java
注:本文中的org.rajawali3d.materials.textures.ATexture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论