Esempio n. 1
0
    private void AddAvatarComponent(GameObject componentObject, ovrAvatarComponent component)
    {
        OvrAvatarComponent ovrComponent = componentObject.AddComponent <OvrAvatarComponent>();

        trackedComponents.Add(component.name, ovrComponent);

        bool combine_meshes = AddRenderParts(ovrComponent, component, componentObject.transform) &&
                              CombineMeshes &&
                              componentObject.name == "body";

        if (combine_meshes)
        {
            ovrComponent.StartMeshCombining(component);
        }
    }
Esempio n. 2
0
    private void AddAvatarComponent(GameObject componentObject, ovrAvatarComponent component)
    {
        OvrAvatarComponent ovrComponent = componentObject.AddComponent <OvrAvatarComponent>();

        trackedComponents.Add(component.name, ovrComponent);

        bool combine_meshes = CombineMeshes && componentObject.name == "body";

        for (UInt32 renderPartIndex = 0; renderPartIndex < component.renderPartCount; renderPartIndex++)
        {
            GameObject renderPartObject = new GameObject();
            renderPartObject.name = GetRenderPartName(component, renderPartIndex);
            renderPartObject.transform.SetParent(componentObject.transform);
            IntPtr renderPart             = GetRenderPart(component, renderPartIndex);
            ovrAvatarRenderPartType  type = CAPI.ovrAvatarRenderPart_GetType(renderPart);
            OvrAvatarRenderComponent ovrRenderPart;
            switch (type)
            {
            case ovrAvatarRenderPartType.SkinnedMeshRender:
                ovrRenderPart = AddSkinnedMeshRenderComponent(renderPartObject, CAPI.ovrAvatarRenderPart_GetSkinnedMeshRender(renderPart));
                break;

            case ovrAvatarRenderPartType.SkinnedMeshRenderPBS:
                ovrRenderPart = AddSkinnedMeshRenderPBSComponent(renderPartObject, CAPI.ovrAvatarRenderPart_GetSkinnedMeshRenderPBS(renderPart));
                break;

            case ovrAvatarRenderPartType.ProjectorRender:
                combine_meshes = false;
                ovrRenderPart  = AddProjectorRenderComponent(renderPartObject, CAPI.ovrAvatarRenderPart_GetProjectorRender(renderPart));
                break;

            default:
                throw new NotImplementedException(
                          string.Format("Unsupported render part type: {0}",
                                        type.ToString()));
            }
            ovrComponent.RenderParts.Add(ovrRenderPart);
        }

        if (combine_meshes)
        {
            ovrComponent.StartMeshCombining(component);
        }
    }
Esempio n. 3
0
    private void AddAvatarComponent(GameObject componentObject, ovrAvatarComponent component)
    {
        OvrAvatarComponent ovrComponent = componentObject.AddComponent <OvrAvatarComponent>();

        trackedComponents.Add(component.name, ovrComponent);

        bool combine_meshes = AddRenderParts(ovrComponent, component, componentObject.transform) &&
                              CombineMeshes &&
                              componentObject.name == "body";

        if (combine_meshes)
        {
            ovrComponent.StartMeshCombining(component);
        }

        if (componentObject.name == OvrAvatarPhysicsHandNames.HAND_LEFT_NAME)
        {
            physicsManager.AddPhysicsComponent(componentObject, OvrAvatarPhysicsHandTypes.HandType.Left);
        }
        if (componentObject.name == OvrAvatarPhysicsHandNames.HAND_RIGHT_NAME)
        {
            physicsManager.AddPhysicsComponent(componentObject, OvrAvatarPhysicsHandTypes.HandType.Right);
        }
    }