Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

szt243660543/360VR

Open more actions menu

Repository files navigation

360 VR SDK

这是一个小型的VR库,可以快速帮助你构建VR应用程序。(项目包含ijkplayer framework 和资源,所以项目有点大,请耐心下载!)(项目约150MB,sdk实际大小为9Mb)
This is a small VR library that can quickly help you build VR app. (As the project contains the ijkplayer framework and resources, so the project a little big, please be patient to download!)(About 150Mb)

Warning

不支持模拟器,请在真机下测试。(模拟器下会报错)
not support the simulator,Please run on a real machine. (the simulator will make a mistake.)

Example Preview

imageimage

How to use vr sdk? - See:GongFu SDK 1.14.pdf

   SZTLibrary.h

    // create sdk based on Controller
    self.sztLibrary = [[SZTLibrary alloc] initWithController:self];
    
    or
    // create sdk based on view
    self.sztLibrary = [[SZTLibrary alloc] initWithView:self.view];

1、AVPlayer - 模式切换/滤波器切换 (change Render Model/change Filter)

2、ijkPlayer

imageimage  

// Render Model
typedef NS_ENUM(NSInteger, SZTRenderModel) {
    SZTVR_2D,                                   // 2d
    SZTVR_SPHERE,                               // 全景
    SZTVR_STEREO_HEMISPHERE,                    // 3D180(左右格式)
    SZTVR_STEREO_SPHERE,                        // 立体全景(上下格式)
    SZTVR_PLANE,                                // 平面
    SZTVR_DOME180,                              // 圆顶180
    SZTVR_STEREO_PLANE_LEFT_RIGHT,              // 立体平面 - 上下
    SZTVR_STEREO_PLANE_UP_DOWN,                 // 立体平面 - 左右
    SZTVR_FISHSPHERE_HIGH,                      // 960 * 2560
    SZTVR_FISHSPHERE_RETINA_HIGH,               // 1520 * 2688
    SZTVR_FISHSPHERE_MEDIUM,                    // 960 * 1920
    SZTVR_FISHSPHERE_RETINA_MEDIUM,             // 1080 * 1920
    SZTVR_3D_MODEL,                             // 3D模型
    SZTVR_CURVEDSURFACE,                        // 曲面屏幕 - 不规则曲面(5面)
    SZTVR_SECTOR,                               // 扇形曲面 - 平滑曲面
};

// Filter Mode
typedef NS_ENUM(NSInteger, SZTFilterMode) {
    SZTVR_NORMAL,           // 普通
    SZTVR_LUMINANCE,        // 像素色值亮度平均,图像黑白 (黑白效果)
    SZTVR_PIXELATE,         // 马赛克
    SZTVR_EXPOSURE,         // 曝光 (美白)
    SZTVR_DISCRETIZE,       // 离散
    SZTVR_BLUR,             // 模糊
    SZTVR_BILATERAL,        // 双边模糊
    SZTVR_HUE,              // 饱和度 
    SZTVR_POLKADOT,         // 像素圆点花样
    SZTVR_GAMMA,            // 伽马线
    SZTVR_GLASSSPHERE,      // 水晶球效果
    SZTVR_CROSSHATCH,       // 法线交叉线
};

3、单双屏切换

typedef NS_ENUM(NSInteger, SZTModeDisplay) {
    SZTModeDisplayNormal,   // 普通模式
    SZTModeDisplayGlass,    // 分屏模式
};


/**
 * 设置单双屏幕模式  - 默认分屏
 */
- (void)dispalyMode:(SZTModeDisplay)mode;

// 使用方法
[self.SZTLibrary dispalyMode:SZTModeDisplayNormal];

4、陀螺仪/触摸/陀&触 (gyroscope or touch)

sdk集成了gvr处理陀螺仪数据的方法,效果更好。

typedef NS_ENUM(NSInteger, SZTSensorMode) {
    SZTSensorNormal,       // 系统默认处理
    SZTSensorGvr,          // gvr陀螺仪处理(有跟随效果)
};

typedef NS_ENUM(NSInteger, SZTModeInteractive) {
    SZTModeInteractiveTouch,            // 触摸
    SZTModeInteractiveMotion,           // 陀螺仪
    SZTModeInteractiveMotionWithTouch,  // 陀螺仪和触摸
};

/**
 * 设置交互模式  - 默认陀螺仪
 */
- (void)interactiveMode:(SZTModeInteractive)mode;

// 使用方法
[self.SZTLibrary interactiveMode:SZTModeInteractiveMotion];

5、移动/缩放/旋转/贝塞尔 (animation - moveTo/scaleTo/rotateTo/bezierTo)

image  

6、图片加载 - 网络/本地图 (load image by local path or url)

image  

7、Gif / APng动图加载 (load gif or aPng)

image  

8、Obj模型加载 / MD2模型加载 (load Obj model or MD2 model)

image  

9、3D立体音效 - openAl (3d sound, use openAl)

    SZTAudio * audio = [[SZTAudio alloc] init];
    
    NSString* path = [[NSBundle mainBundle] pathForResource:@"sound1" ofType:@"wav"];
    Sound *sounds = [[Sound alloc] initWithFilePath:path];
    [audio addSubAudio:sounds];
    [sounds setPosition:0.0 Y:0.0 Z:-50.0];

10、畸变矫正 (distortion correction)

image  

typedef NS_ENUM(NSInteger, SZTDistortion) {
    SZTDistortionNormal,   // 无畸变
    SZTBarrelDistortion,   // 桶形畸变模式
};

/**
 * 畸变模式 - 默认无畸变
 */
- (void)distortionMode:(SZTDistortion)mode;

// 使用方法
[self.SZTLibrary distortionMode:SZTDistortionNormal];

11、Label控件/大量弹幕 (load label, barrage)

image  

12、进度条控件 (load Progress bar)

image  

13、焦点拾取/点击拾取 (ray picking/touch picking)

    // 要使用热点拾取功能,一定需要设置该接口
    [self.sztLibrary setFocusPicking:YES];
     
    // 热点拾取方法   object为要被拾取的对象
    SZTTouch *touch = [[SZTTouch alloc] initWithTouchObject:object];
    
    // 拾取的三个状态
    [touch willTouchCallBack:^(GLKVector3 vec) {
        NSLog(@"will select");
    }];
    
    [touch didTouchCallback:^(GLKVector3 vec) {
        NSLog(@"select");
    }];
    
    [touch endTouchCallback:^(GLKVector3 vec) {
        NSLog(@"will leave");
    }];

14、输入框控件 (keyboard bar)

image  

15、更多高级控件 (more)

1、粒子系统
2、环形控件
3、九宫格控件,根据头距自动上下滑动
4、耳机线控拾取
5、储物盒控件
6、视频预览控件(基于九宫格)

功能不一一展示在这里了,有需要的加群讨论。

编辑json脚本,加载vr场景 (非程序员也可以编辑vr app)

可视化编辑器还在开发中,请先使用json脚本编辑。
    // create sdk
    self.sztLibrary = [[SZTLibrary alloc] initWithController:self];
    [self.sztLibrary setFocusPicking:YES]; // 开启热点交互
    
    /*** json 脚本****/
    NSString *path = [NSString stringWithFormat:@"%@/%@",SANDBOXPATH, @"supermarket.json"];
    
    script = [[ScriptUI alloc] initWithSandboxPath:path]; 
    [script setVideoPlayer:SZT_IJKPlayer]; // 脚本的播放器使用ijkplayer/avplayer
    [self.sztLibrary addSubObject:script];

脚本规范查看:http://www.vrkongfu.com/doc/doc_zh.html

项目测试:把脚本和资源放到app的根目录下
脚本和资源地址:https://pan.baidu.com/s/1skAdqHZ
脚本空模版:

Script specification:http://www.vrkongfu.com/doc/doc_en.html
Project testing: Put scripts and resources in the root directory of app
scripts and resources:https://pan.baidu.com/s/1skAdqHZ
Template:

imageimage  

AR

image

Join us

我们会不定期的更新sdk,加入更多新功能,大家有新的需要或好的想法,欢迎大家加入群一起讨论。
We will update SDK regularly.Welcome to join the group for discussion.

QQ Group

image

About

This is a small VR library that can quickly help you build VR app.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.