<commit_before>﻿using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public class PipelineManager : MonoBehaviour 
{
    [DllImport ("yarrar")]
    private static extern IntPtr initYarrar(int width, int height); 
    [DllImport ("yarrar")]
    private static extern IntPtr deinitYarrar();
    [DllImport ("yarrar")]
    private static extern IntPtr getPose(IntPtr pixelBuffer, int width, int height);    

    [Serializable]
    private struct Pose
    {
        public int coordinateSystemId;
        public float[] rotation;
        public float[] translation;
        public float[] camera;
    }

    [Serializable]
    private struct PoseCollection
    {
        public Pose[] poses;
    }

    private struct CoordinateSystem
    {
        public List<GameObject> objects;
        public GameObject camera;
        public int cullingMask;
        public int layerNumber;
    }

    public GameObject m_backgroundCanvas;
    public GameObject m_cameraPrefab;

    private Dictionary<int, CoordinateSystem> m_coordinateSystems = new Dictionary<int, CoordinateSystem>();
    private WebCamTexture m_webcamTexture;

    void Start()
    {
        m_webcamTexture = new WebCamTexture();
        var rawImage = m_backgroundCanvas.GetComponent<RawImage>();
        rawImage.texture = m_webcamTexture;
        rawImage.material.mainTexture = m_webcamTexture;
        m_webcamTexture.Play();

        initYarrar(m_webcamTexture.width, m_webcamTexture.height);
        Debug.Log("Yarrar initialized.");
    }

    void OnDestroy() 
    {
        deinitYarrar();
        Debug.Log("Yarrar deinitialized.");
    }

    void Update() 
    {
        Color32[] pixelData = m_webcamTexture.GetPixels32();
        IntPtr poseDataStringPtr;
        GCHandle handle = GCHandle.Alloc(pixelData, GCHandleType.Pinned);
        try
        {
            poseDataStringPtr = getPose(handle.AddrOfPinnedObject(), 
                m_webcamTexture.width, 
                m_webcamTexture.height);
        }<commit_msg>Use screen dimensions to get WebCamTexture to full screen.<commit_after>﻿using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public class PipelineManager : MonoBehaviour 
{
    [DllImport ("yarrar")]
    private static extern IntPtr initYarrar(int width, int height); 
    [DllImport ("yarrar")]
    private static extern IntPtr deinitYarrar();
    [DllImport ("yarrar")]
    private static extern IntPtr getPose(IntPtr pixelBuffer, int width, int height);    

    [Serializable]
    private struct Pose
    {
        public int coordinateSystemId;
        public float[] rotation;
        public float[] translation;
        public float[] camera;
    }

    [Serializable]
    private struct PoseCollection
    {
        public Pose[] poses;
    }

    private struct CoordinateSystem
    {
        public List<GameObject> objects;
        public GameObject camera;
        public int cullingMask;
        public int layerNumber;
    }

    public GameObject m_backgroundCanvas;
    public GameObject m_cameraPrefab;

    private Dictionary<int, CoordinateSystem> m_coordinateSystems = new Dictionary<int, CoordinateSystem>();
    private WebCamTexture m_webcamTexture;

    void Start()
    {
        m_webcamTexture = new WebCamTexture();
        var rawImage = m_backgroundCanvas.GetComponent<RawImage>();
        rawImage.texture = m_webcamTexture;
        rawImage.material.mainTexture = m_webcamTexture;
        rawImage.rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height);
        m_webcamTexture.Play();

        initYarrar(m_webcamTexture.width, m_webcamTexture.height);
        Debug.Log("Yarrar initialized.");
    }

    void OnDestroy() 
    {
        deinitYarrar();
        Debug.Log("Yarrar deinitialized.");
    }

    void Update() 
    {
        Color32[] pixelData = m_webcamTexture.GetPixels32();
        IntPtr poseDataStringPtr;
        GCHandle handle = GCHandle.Alloc(pixelData, GCHandleType.Pinned);
        try
        {
            poseDataStringPtr = getPose(handle.AddrOfPinnedObject(), 
                m_webcamTexture.width, 
                m_webcamTexture.height);
        }
{'fraction_non_alphanumeric': 0.08275543226999538, 'fraction_numerical': 0.0020804438280166435, 'mean_word_length': 2.8123348017621144, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2141779', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1202, 'n_words': 286}