<commit_before>/* Copyright 2015 Samsung Electronics Co., LTD
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gearvrf.sample.sceneobjects;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;

import org.gearvrf.GVRAndroidResource;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRMaterial;
import org.gearvrf.GVRRenderData;
import org.gearvrf.GVRScene;
import org.gearvrf.GVRSceneObject;
import org.gearvrf.GVRScript;
import org.gearvrf.GVRTexture;
import org.gearvrf.scene_objects.GVRCameraSceneObject;
import org.gearvrf.scene_objects.GVRConeSceneObject;
import org.gearvrf.scene_objects.GVRCubeSceneObject;
import org.gearvrf.scene_objects.GVRCylinderSceneObject;
import org.gearvrf.scene_objects.GVRSphereSceneObject;
import org.gearvrf.scene_objects.GVRTextViewSceneObject;
import org.gearvrf.scene_objects.GVRVideoSceneObject;
import org.gearvrf.scene_objects.GVRVideoSceneObject.GVRVideoType;
import org.gearvrf.scene_objects.GVRViewSceneObject;
import org.gearvrf.scene_objects.view.GVRView;

import android.media.MediaPlayer;
import android.view.Gravity;

public class SampleViewManager extends GVRScript {
    private List<GVRSceneObject> objectList = new ArrayList<GVRSceneObject>();

    private int currentObject = 0;
    private SceneObjectActivity mActivity;

    SampleViewManager(SceneObjectActivity activity) {
        mActivity = activity;
    }

    @Override
    public void onInit(GVRContext gvrContext) {

        GVRScene scene = gvrContext.getNextMainScene();

        // load texture asynchronously
        Future<GVRTexture> futureTexture = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.gearvr_logo));
        Future<GVRTexture> futureTextureTop = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.top));
        Future<GVRTexture> futureTextureBottom = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.bottom));
        ArrayList<Future<GVRTexture>> futureTextureList = new ArrayList<Future<GVRTexture>>(
                3);
        futureTextureList.add(futureTextureTop);
        futureTextureList.add(futureTexture);
        futureTextureList.add(futureTextureBottom);

        // setup material
        GVRMaterial material = new GVRMaterial(gvrContext);
        material.setMainTexture(futureTexture);

        // create a scene object (this constructor creates a rectangular scene
        // object that uses the standard 'unlit' shader)
        GVRSceneObject quadObject = new GVRSceneObject(gvrContext, 4.0f, 2.0f);
        GVRCubeSceneObject cubeObject = new GVRCubeSceneObject(gvrContext,
                true, material);
        GVRSphereSceneObject sphereObject = new GVRSphereSceneObject(
                gvrContext, true, material);
        GVRCylinderSceneObject cylinderObject = new GVRCylinderSceneObject(
                gvrContext, true, material);
        GVRConeSceneObject coneObject = new GVRConeSceneObject(gvrContext,
                true, material);
        GVRViewSceneObject webViewObject = createWebViewObject(gvrContext);
        GVRCameraSceneObject cameraObject = new GVRCameraSceneObject(
                gvrContext, mActivity, 3.6f, 2.0f, mActivity.getCamera());
        cameraObject.setUpCameraForVrMode(1); // set up 60 fps camera preview.
        GVRVideoSceneObject videoObject = createVideoObject(gvrContext);
        GVRTextViewSceneObject textViewSceneObject = new GVRTextViewSceneObject(
                gvrContext, mActivity, "Hello World!");
        textViewSceneObject.setGravity(Gravity.CENTER);
        textViewSceneObject
                .setTextSize(textViewSceneObject.getTextSize() * 1.5f);
        objectList.add(quadObject);
        objectList.add(cubeObject);
        objectList.add(sphereObject);
        objectList.add(cylinderObject);
        objectList.add(coneObject);
        objectList.add(webViewObject);
        objectList.add(cameraObject);
        objectList.add(videoObject);
        objectList.add(textViewSceneObject);

        // turn all objects off, except the first one
        int listSize = objectList.size();
        for (int i = 1; i < listSize; i++) {
            objectList.get(i).getRenderData().setRenderMask(0);
        }

        quadObject.getRenderData().setMaterial(material);

        // set the scene object positions
        quadObject.getTransform().setPosition(0.0f, 0.0f, -3.0f);<commit_msg>Removed the activity argument from the constructor to create GVRCameraSceneObject.<commit_after>/* Copyright 2015 Samsung Electronics Co., LTD
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gearvrf.sample.sceneobjects;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;

import org.gearvrf.GVRAndroidResource;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRMaterial;
import org.gearvrf.GVRRenderData;
import org.gearvrf.GVRScene;
import org.gearvrf.GVRSceneObject;
import org.gearvrf.GVRScript;
import org.gearvrf.GVRTexture;
import org.gearvrf.scene_objects.GVRCameraSceneObject;
import org.gearvrf.scene_objects.GVRConeSceneObject;
import org.gearvrf.scene_objects.GVRCubeSceneObject;
import org.gearvrf.scene_objects.GVRCylinderSceneObject;
import org.gearvrf.scene_objects.GVRSphereSceneObject;
import org.gearvrf.scene_objects.GVRTextViewSceneObject;
import org.gearvrf.scene_objects.GVRVideoSceneObject;
import org.gearvrf.scene_objects.GVRVideoSceneObject.GVRVideoType;
import org.gearvrf.scene_objects.GVRViewSceneObject;
import org.gearvrf.scene_objects.view.GVRView;

import android.media.MediaPlayer;
import android.view.Gravity;

public class SampleViewManager extends GVRScript {
    private List<GVRSceneObject> objectList = new ArrayList<GVRSceneObject>();

    private int currentObject = 0;
    private SceneObjectActivity mActivity;

    SampleViewManager(SceneObjectActivity activity) {
        mActivity = activity;
    }

    @Override
    public void onInit(GVRContext gvrContext) {

        GVRScene scene = gvrContext.getNextMainScene();

        // load texture asynchronously
        Future<GVRTexture> futureTexture = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.gearvr_logo));
        Future<GVRTexture> futureTextureTop = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.top));
        Future<GVRTexture> futureTextureBottom = gvrContext
                .loadFutureTexture(new GVRAndroidResource(gvrContext,
                        R.drawable.bottom));
        ArrayList<Future<GVRTexture>> futureTextureList = new ArrayList<Future<GVRTexture>>(
                3);
        futureTextureList.add(futureTextureTop);
        futureTextureList.add(futureTexture);
        futureTextureList.add(futureTextureBottom);

        // setup material
        GVRMaterial material = new GVRMaterial(gvrContext);
        material.setMainTexture(futureTexture);

        // create a scene object (this constructor creates a rectangular scene
        // object that uses the standard 'unlit' shader)
        GVRSceneObject quadObject = new GVRSceneObject(gvrContext, 4.0f, 2.0f);
        GVRCubeSceneObject cubeObject = new GVRCubeSceneObject(gvrContext,
                true, material);
        GVRSphereSceneObject sphereObject = new GVRSphereSceneObject(
                gvrContext, true, material);
        GVRCylinderSceneObject cylinderObject = new GVRCylinderSceneObject(
                gvrContext, true, material);
        GVRConeSceneObject coneObject = new GVRConeSceneObject(gvrContext,
                true, material);
        GVRViewSceneObject webViewObject = createWebViewObject(gvrContext);
        GVRCameraSceneObject cameraObject = new GVRCameraSceneObject(
                gvrContext, 3.6f, 2.0f, mActivity.getCamera());
        cameraObject.setUpCameraForVrMode(1); // set up 60 fps camera preview.
        GVRVideoSceneObject videoObject = createVideoObject(gvrContext);
        GVRTextViewSceneObject textViewSceneObject = new GVRTextViewSceneObject(
                gvrContext, mActivity, "Hello World!");
        textViewSceneObject.setGravity(Gravity.CENTER);
        textViewSceneObject
                .setTextSize(textViewSceneObject.getTextSize() * 1.5f);
        objectList.add(quadObject);
        objectList.add(cubeObject);
        objectList.add(sphereObject);
        objectList.add(cylinderObject);
        objectList.add(coneObject);
        objectList.add(webViewObject);
        objectList.add(cameraObject);
        objectList.add(videoObject);
        objectList.add(textViewSceneObject);

        // turn all objects off, except the first one
        int listSize = objectList.size();
        for (int i = 1; i < listSize; i++) {
            objectList.get(i).getRenderData().setRenderMask(0);
        }

        quadObject.getRenderData().setMaterial(material);

        // set the scene object positions
        quadObject.getTransform().setPosition(0.0f, 0.0f, -3.0f);
{'fraction_non_alphanumeric': 0.07966333920532394, 'fraction_numerical': 0.006067723624975534, 'mean_word_length': 3.359641638225256, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '986552', 'n_tokens_mistral': 2954, 'n_tokens_neox': 2837, 'n_words': 643}