private FireBoxRoom MakeRoom()
        {
            FireBoxRoom fireBoxRoom  = new FireBoxRoom();
            float       uniformScale = room.UniformScale;

            // copy data
            fireBoxRoom.Assets.Assets    = room.AllAssets.ToArray();
            fireBoxRoom.Room.Elements    = room.RoomElements.ToArray();
            fireBoxRoom.Room.FarDistance = room.FarPlaneDistance;

            if (room.PortalPos != null)
            {
                fireBoxRoom.Room.pos  = JanusUtil.FormatVector3(room.PortalPos.Value);
                fireBoxRoom.Room.xdir = JanusUtil.FormatVector3(room.PortalXDir.Value);
                fireBoxRoom.Room.ydir = JanusUtil.FormatVector3(room.PortalYDir.Value);
                fireBoxRoom.Room.zdir = JanusUtil.FormatVector3(room.PortalZDir.Value);
            }

            // implicit operators
            fireBoxRoom.Room.skybox_back_id  = room.SkyboxBack;
            fireBoxRoom.Room.skybox_front_id = room.SkyboxFront;
            fireBoxRoom.Room.skybox_left_id  = room.SkyboxLeft;
            fireBoxRoom.Room.skybox_right_id = room.SkyboxRight;
            fireBoxRoom.Room.skybox_up_id    = room.SkyboxUp;
            fireBoxRoom.Room.skybox_down_id  = room.SkyboxDown;

            fireBoxRoom.Room.cubemap_irradiance_id = room.CubemapIrradiance;
            fireBoxRoom.Room.cubemap_radiance_id   = room.CubemapRadiance;

            return(fireBoxRoom);
        }
Example #2
0
        public void SetNoUnityObj(JanusRoom room)
        {
            //Vector3 xDir = Vector3.right;
            //Vector3 yDir = Vector3.up;
            //Vector3 zDir = Vector3.forward;
            //xDir.x *= -1;
            //yDir.x *= -1;
            //zDir.x *= -1;

            //xdir = JanusUtil.FormatVector3(xDir, JanusGlobals.DecimalCasesForTransforms);
            //ydir = JanusUtil.FormatVector3(yDir, JanusGlobals.DecimalCasesForTransforms);
            //zdir = JanusUtil.FormatVector3(zDir, JanusGlobals.DecimalCasesForTransforms);
            pos      = JanusUtil.FormatVector3(Vector3.zero, JanusGlobals.DecimalCasesForTransforms);
            scale    = JanusUtil.FormatVector3(Vector3.one * room.UniformScale, JanusGlobals.DecimalCasesForTransforms);
            lighting = room.LightmapType == LightmapExportType.None;
        }
Example #3
0
        public void SetUnityObj(GameObject obj, JanusRoom room)
        {
            unityObj = obj;

            Transform trans    = obj.transform;
            Vector3   position = trans.position;

            Quaternion rot = trans.rotation;

            if (room.UseEulerRotations)
            {
                Vector3 euler = JanusUtil.ConvertEulerRotation(rot.eulerAngles);
                rotation = JanusUtil.FormatVector3(euler, JanusGlobals.DecimalCasesForTransforms);
            }
            else
            {
                Vector3 xDir = JanusUtil.ConvertDirection(rot * Vector3.right);
                Vector3 yDir = JanusUtil.ConvertDirection(rot * Vector3.up);
                Vector3 zDir = JanusUtil.ConvertDirection(rot * Vector3.forward);

                xdir = JanusUtil.FormatVector3(xDir, JanusGlobals.DecimalCasesForTransforms);
                ydir = JanusUtil.FormatVector3(yDir, JanusGlobals.DecimalCasesForTransforms);
                zdir = JanusUtil.FormatVector3(zDir, JanusGlobals.DecimalCasesForTransforms);
            }
            pos = JanusUtil.FormatVector3(JanusUtil.ConvertPosition(position, room.UniformScale), JanusGlobals.DecimalCasesForTransforms);

            Vector3 sca = trans.lossyScale;

            if (sca.x < 0 || sca.y < 0 || sca.z < 0)
            {
                cull_face = "front";
            }
            scale = JanusUtil.FormatVector3(trans.lossyScale * room.UniformScale, JanusGlobals.DecimalCasesForTransforms);

            if (obj.isStatic &&
                room.LightmapType != LightmapExportType.None)
            {
                lighting = false;
            }
            else
            {
                lighting = true;
            }
        }