7 Star 12 Fork 10

猫骑士 / BimHousePlayer

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

BimHousePlayer

介绍

UE4动态加载模型支持FBX/OBJ等等,使用assimp库。UI使用蓝图开发,功能使用C++开发 目前实现功能:

  1. 动态加载模型
  2. 射线选取,高亮
  3. 碰撞检测
  4. 动态生成菜单
  5. 自定义插件
  6. 右键弹出菜单

效果图

  • 打开本地文件 输入图片说明
  • 高亮,射线选取 输入图片说明
  • 碰撞检测 输入图片说明
  • 右键弹出菜单 输入图片说明

使用说明

  1. 工程使用UE4.21.1版本
  2. 如果第一步build失败,请将..\ThirdParty\assimp\bin\x64目录下的assimp-vc140-mt.dll拷贝到..\Binaries\Win64目录下即可
  3. 打开scene.bhp\scene.json文件,bhp是自定义的文件格式,里面定义了场景的相关描述信息,json格式,导入的模型需要放在..\Scenes\Mesh目录下
  4. 在scene.bhp\scene.json中添加对应的模型信息,运行程序选择场景文件,程序就会加载导入的模型了

.bhp文件说明

{
    "SystemInfo":{                                      //系统信息
        "version":"1.0",                                //版本
        "leftHand":true,                                //左手右手系
        "up":"z",                                       //相机Up方向
        "unit":"cm"                                     //场景的单位:mm,cm,m
    },
    "Home":[                                            //根节点Root
        {
            "style":"空载",                              //装修风格名称,如深色、浅色,空载(毛坯)等等,一套风格是一个完整的场景,BimHomePlayer可以加载,并可以进行整体装修风格的切换
            "room":[                                    //该风格下空间列表,如客厅,餐厅,卧室等等
                {
                    "roomID":"KT",                      //空间编码
                    "additions":[                       //该空间下有哪些选装的部品
                        
                    ]
                }
            ],
            "Mesh":[                                    //部品信息
                {
                    "guid":"canzhuo",                   //模型名称(模型文件名)
                    "suffix":"obj",                     //模型后缀
                    "name":"123",                       //模型显示名称
                    "currentMaterial":"bh2321231hh112", //模型当前的材质,对应材质文件的名称
                    "materialList":[                    //模型可以替换的材质列表
                        "31231231",                        
                        "12312312",
                        "23232323"
                    ],
                    "meshList":[                        //模型可以替换的模型列表
                        "1231232",
                        "1232132"
                    ],
                    "position":[                        //模型位置
                        0,
                        0,
                        0
                    ],
                    "rotation":[                        //旋转
                        0,
                        0,
                        0
                    ],
                    "scale":[                           //缩放值
                        0,
                        0,
                        0
                    ]
                }
            ],
            "Material":[                                //该装修风格下所有的材质
                "1231221434",
                "1234122222"
            ],
            "Light":[                                   //该装修风格下灯光
                {
                    "guid":"123123123",
                    "name":"sdasdasda",
                    "type":"point",
                    "position":[
                        0,
                        0,
                        0
                    ],
                    "rotation":[
                        0,
                        0,
                        0
                    ],
                    "scale":[
                        1,
                        1,
                        1
                    ],
                    "target":[
                        0,
                        0,
                        0
                    ],
                    "angle":45,
                    "length":0,
                    "width":0,
                    "color":[
                        255,
                        255,
                        255
                    ],
                    "strength":10
                }
            ]
        },
        {
            "style":"深色",                  //定义如上
            "room":[
                {
                    "roomID":"KT",
                    "additions":[
                        "1231231",
                        "123234",
                        "656565"
                    ]
                }
            ],
            "Mesh":[
                {
                    "guid":"2312312nh123j1h3",
                    "name":"zuiaahhh",
                    "currentMaterial":"bh2321231hh112",
                    "MaterialList":[
                        "31231231",
                        "12312312",
                        "23232323"
                    ],
                    "meshList":[
                        "1231232",
                        "1232132"
                    ],
                    "roomID":"KT",
                    "saleType":1,
                    "meshType":"door",
                    "position":[
                        0,
                        0,
                        0
                    ],
                    "rotation":[
                        0,
                        0,
                        0
                    ],
                    "scaler":[
                        0,
                        0,
                        0
                    ]
                }
            ],
            "Material":[
                {
                    "guid":"1231221434",
                    "name":"木饰面",
                    "type":1,
                    "baseColor":[
                        0,
                        0,
                        0,
                        1
                    ],
                    "diffuseMap":"./Texture/木纹.jpg",
                    "UVOffsetX":0,
                    "UVOffsetY":0,
                    "UVScaleX":0.1,
                    "UVScaleY":0.25,
                    "metallic":0.1,
                    "roughness":0.7,
                    "specular":0.4,
                    "emissive":false,
                    "opacity":1
                }
            ],
            "Light":[
                {
                    "guid":"123123123",
                    "name":"sdasdasda",
                    "type":"point",
                    "position":[
                        0,
                        0,
                        0
                    ],
                    "rotation":[
                        0,
                        0,
                        0
                    ],
                    "scale":[
                        1,
                        1,
                        1
                    ],
                    "target":[
                        0,
                        0,
                        0
                    ],
                    "angle":45,
                    "length":0,
                    "width":0,
                    "color":[
                        255,
                        255,
                        255
                    ],
                    "strength":10
                }
            ]
        }
    ]
}

后续计划

空闲时会不定期添加功能,主要看时间或者大家有什么希望添加的功能也可以提出来

Comments ( 11 )

Sign in for post a comment

About

UE4动态加载模型支持FBX/OBJ等等,使用assimp库。UI使用蓝图开发,功能使用C++开发 spread retract
C++ and 3 more languages
LGPL-3.0
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more
C++
1
https://git.oschina.net/catknight2016/BimHousePlayer.git
git@git.oschina.net:catknight2016/BimHousePlayer.git
catknight2016
BimHousePlayer
BimHousePlayer
master

Search