0
我一直在使用StreamingTexture在Alpha通道屏幕上显示视频。视频的上半部分有实际内容,下半部分包含Alpha通道。Rajawali 3D:围绕枢轴点旋转
plane = new Plane(1, 2, 1, 1);//Plane height is 2 times the plane width due to the video size.
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setLooping(true);
Uri videoUrl = Uri.parse("android.resource://" + getContext().getPackageName() + "/"
+ R.raw.angel);
mMediaPlayer.setDataSource(getContext(), Uri.parse(videoUrl.toString()));
mMediaPlayer.prepareAsync(); //prepare the player (asynchronous)
mMediaPlayer.setOnPreparedListener(mp -> {
mp.start(); //start the player only when it is prepared
});
} catch (IOException e) {
e.printStackTrace();
}
// create texture from media player video
mVideoTexture = new StreamingTexture("video", mMediaPlayer);
// set material with video texture
Material material =
new Material(new VertexShader(R.raw.custom_vertix_shader),
new FragmentShader(R.raw.custom_fragment_shader));
material.setColorInfluence(0f);
try {
material.addTexture(mVideoTexture);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
plane.setMaterial(material);
getCurrentScene().addChild(plane);
现在,当我旋转使用
plane.setRotation(Vector3.Axis.Z, angle);
的矩形平面的大小该平面(1,2)旋转从中心(0.5,1),因为它被认为但因为视频仅示出了上上半部分看起来很奇怪。它看起来像视频从下半部分旋转。
解选项:
从(0.5,0.5),而不是旋转它(0.5,1),但是没有方法来这样做。
将平面的大小设置为1,1并剪切视频的下半部分,但没有办法做到这一点。
请建议我可以采取哪些其他选择,或者是否有使用上述选项的解决方案。