/**
         * \brief Create a Mesh from a json file (comntaining mesh data) and a texture file.
         * @param am the app AssetManager.
         * @param mesh_file the mesh file to load
         * @param texture_file the texture file to load
         * @return true on success.
         */
        public bool InitMesh(AssetManager am, String mesh_file, String texture_file)
        {
            _glLoaded = false;
            LoadMesh(am, mesh_file);
            texture     = RenderUtils.loadTexture(am, texture_file, textureDims);
            _meshLoaded = true;

            return(true);
        }
Example #2
0
        /**
         * \brief Initialize a VideoMesh object.
         *
         * Intialize a VideMesh object, if necessary creates its own PikkartVideoPlayer.
         * @param am the app AssetManager.
         * @param movieUrl the video to be played, URL or file path
         * @param keyframeUrl the video keyframe image to be displayed
         * @param seekPosition the starting position (in milliseconds)
         * @param autostart whatever the video should autostart on detection
         * @param pikkartVideoPlayer an external PikkartVideoPlayer to use. If null, an internal one will be created.
         * @return true on success.
         */
        public bool InitMesh(AssetManager am,
                             String movieUrl,
                             String keyframeUrl,
                             int seekPosition,
                             bool autostart,
                             PikkartVideoPlayer pikkartVideoPlayer)
        {
            _glLoaded = false;

            GenerateMesh();
            if (pikkartVideoPlayer == null)
            {
                mPikkartVideoPlayer = new PikkartVideoPlayer();
                mPikkartVideoPlayer.init();
                mPikkartVideoPlayer.setActivity(mParentActivity);
            }
            else
            {
                mPikkartVideoPlayer = pikkartVideoPlayer;
            }
            mMovieUrl = movieUrl;
            mKeyframeTextureByteBuffer = RenderUtils.loadTexture(am, keyframeUrl, mKeyframeTextureDims);
            keyframeAspectRatio        = (float)mKeyframeTextureDims[1] / (float)mKeyframeTextureDims[0];

            mSeekPosition = seekPosition;
            mAutostart    = autostart;

            mTexCoordTransformationMatrix = new float[16];


            mIconBusyTextureByteBuffer  = RenderUtils.loadTexture(am, "media/busy.png", mIconBusyTextureDims);
            mIconPlayTextureByteBuffer  = RenderUtils.loadTexture(am, "media/play.png", mIconPlayTextureDims);
            mIconErrorTextureByteBuffer = RenderUtils.loadTexture(am, "media/error.png", mIconErrorTextureDims);
            _meshLoaded = true;

            return(true);
        }