Commit for 2021.10.30 15-08-40.7z
This commit is contained in:
parent
fb5749d8a3
commit
386bf04eb9
21
Makefile
21
Makefile
@ -174,7 +174,8 @@ else
|
|||||||
FLAGS += -DUF_RTTI -rtti
|
FLAGS += -DUF_RTTI -rtti
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SRCS_DLL += $(wildcard $(ENGINE_SRC_DIR)/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*/*.cpp)
|
# SRCS_DLL += $(wildcard $(ENGINE_SRC_DIR)/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*/*.cpp)
|
||||||
|
SRCS_DLL += $(wildcard $(ENGINE_SRC_DIR)/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(ENGINE_SRC_DIR)/*/*/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*.cpp) $(wildcard $(EXT_SRC_DIR)/*/*/*/*/*.cpp)
|
||||||
OBJS_DLL += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_DLL))
|
OBJS_DLL += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS_DLL))
|
||||||
BASE_DLL += lib$(LIB_NAME)
|
BASE_DLL += lib$(LIB_NAME)
|
||||||
IM_DLL += $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a
|
IM_DLL += $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a
|
||||||
@ -197,7 +198,6 @@ EXT_IM_DLL += $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_E
|
|||||||
EXT_EX_DLL += $(BIN_DIR)/exe/lib/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION)
|
EXT_EX_DLL += $(BIN_DIR)/exe/lib/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION)
|
||||||
# Client EXE
|
# Client EXE
|
||||||
SRCS += $(wildcard $(CLIENT_SRC_DIR)/*.cpp) $(wildcard $(CLIENT_SRC_DIR)/*/*.cpp)
|
SRCS += $(wildcard $(CLIENT_SRC_DIR)/*.cpp) $(wildcard $(CLIENT_SRC_DIR)/*/*.cpp)
|
||||||
# SRCS += $(CLIENT_SRC_DIR)/smain.cpp
|
|
||||||
OBJS += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS))
|
OBJS += $(patsubst %.cpp,%.$(ARCH).$(CC).o,$(SRCS))
|
||||||
TARGET += $(BIN_DIR)/exe/$(TARGET_NAME).$(CC).$(TARGET_EXTENSION)
|
TARGET += $(BIN_DIR)/exe/$(TARGET_NAME).$(CC).$(TARGET_EXTENSION)
|
||||||
# Shaders
|
# Shaders
|
||||||
@ -214,18 +214,12 @@ DEPS += -lkallisti -lc -lm -lgcc -lstdc++ # -l$(LIB_NAME) -l$(EXT_LIB_NAME)
|
|||||||
%.$(ARCH).$(CC).o: %.cpp
|
%.$(ARCH).$(CC).o: %.cpp
|
||||||
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
||||||
|
|
||||||
$(EX_DLL): FLAGS += -DUF_EXPORTS -DJSON_DLL_BUILD
|
$(EX_DLL): FLAGS += -DUF_EXPORTS -DEXT_EXPORTS -DJSON_DLL_BUILD
|
||||||
$(EX_DLL): $(OBJS_DLL)
|
$(EX_DLL): $(OBJS_DLL)
|
||||||
$(KOS_AR) cru $@ $^
|
$(KOS_AR) cru $@ $^
|
||||||
$(KOS_RANLIB) $@
|
$(KOS_RANLIB) $@
|
||||||
cp $@ $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).a
|
cp $@ $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).a
|
||||||
|
|
||||||
$(EXT_EX_DLL): FLAGS += -DEXT_EXPORTS -DJSON_DLL_BUILD
|
|
||||||
$(EXT_EX_DLL): $(OBJS_EXT_DLL)
|
|
||||||
$(KOS_AR) cru $@ $^
|
|
||||||
$(KOS_RANLIB) $@
|
|
||||||
cp $@ $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).a
|
|
||||||
|
|
||||||
./bin/dreamcast/romdisk.img:
|
./bin/dreamcast/romdisk.img:
|
||||||
$(KOS_GENROMFS) -f ./bin/dreamcast/romdisk.img -d ./bin/dreamcast/romdisk/ -v
|
$(KOS_GENROMFS) -f ./bin/dreamcast/romdisk.img -d ./bin/dreamcast/romdisk/ -v
|
||||||
|
|
||||||
@ -239,23 +233,26 @@ $(TARGET): $(OBJS) ./bin/dreamcast/romdisk.o
|
|||||||
cd ./bin/dreamcast/; ./elf2cdi.sh $(TARGET_NAME)
|
cd ./bin/dreamcast/; ./elf2cdi.sh $(TARGET_NAME)
|
||||||
|
|
||||||
else
|
else
|
||||||
$(ARCH): $(EX_DLL) $(EXT_EX_DLL) $(TARGET) $(TARGET_SHADERS)
|
$(ARCH): $(EX_DLL) $(TARGET) $(TARGET_SHADERS)
|
||||||
|
|
||||||
%.$(ARCH).$(CC).o: %.cpp
|
%.$(ARCH).$(CC).o: %.cpp
|
||||||
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
||||||
|
|
||||||
$(EX_DLL): FLAGS += -DUF_EXPORTS -DJSON_DLL_BUILD
|
$(EX_DLL): FLAGS += -DUF_EXPORTS -DEXT_EXPORTS -DJSON_DLL_BUILD
|
||||||
|
#$(EX_DLL): FLAGS += -DUF_EXPORTS -DJSON_DLL_BUILD
|
||||||
$(EX_DLL): $(OBJS_DLL)
|
$(EX_DLL): $(OBJS_DLL)
|
||||||
$(CXX) -shared -o $(EX_DLL) -Wl,--out-implib=$(IM_DLL) $(OBJS_DLL) $(LIBS) $(INCS) $(LINKS)
|
$(CXX) -shared -o $(EX_DLL) -Wl,--out-implib=$(IM_DLL) $(OBJS_DLL) $(LIBS) $(INCS) $(LINKS)
|
||||||
cp $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).a
|
cp $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_DLL).a
|
||||||
|
|
||||||
|
|
||||||
$(EXT_EX_DLL): FLAGS += -DEXT_EXPORTS -DJSON_DLL_BUILD
|
$(EXT_EX_DLL): FLAGS += -DEXT_EXPORTS -DJSON_DLL_BUILD
|
||||||
$(EXT_EX_DLL): $(OBJS_EXT_DLL)
|
$(EXT_EX_DLL): $(OBJS_EXT_DLL)
|
||||||
$(CXX) -shared -o $(EXT_EX_DLL) -Wl,--out-implib=$(EXT_IM_DLL) $(OBJS_EXT_DLL) $(EXT_LIBS) $(EXT_INCS) $(EXT_LINKS)
|
$(CXX) -shared -o $(EXT_EX_DLL) -Wl,--out-implib=$(EXT_IM_DLL) $(OBJS_EXT_DLL) $(EXT_LIBS) $(EXT_INCS) $(EXT_LINKS)
|
||||||
cp $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).a
|
cp $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).$(TARGET_LIB_EXTENSION).a $(ENGINE_LIB_DIR)/$(ARCH)/$(CC)/$(BASE_EXT_DLL).a
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
$(TARGET): $(OBJS)
|
||||||
$(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -l$(EXT_LIB_NAME) -o $(TARGET)
|
$(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -o $(TARGET)
|
||||||
|
# $(CXX) $(FLAGS) $(OBJS) $(LIBS) $(INCS) $(LINKS) -l$(LIB_NAME) -l$(EXT_LIB_NAME) -o $(TARGET)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"engine": {
|
"engine": {
|
||||||
"scenes": {
|
"scenes": {
|
||||||
"start": "McDonalds",
|
"start": "SH2_McDonalds",
|
||||||
"meshes": { "interleave": false },
|
"meshes": { "interleave": false },
|
||||||
"matrix": { "reverseInfinite": true },
|
"matrix": { "reverseInfinite": true },
|
||||||
"lights": {
|
"lights": {
|
||||||
@ -26,8 +26,8 @@
|
|||||||
"limiter": 0.5,
|
"limiter": 0.5,
|
||||||
"size": 128,
|
"size": 128,
|
||||||
"dispatch": 8,
|
"dispatch": 8,
|
||||||
"cascades": 3,
|
"cascades": 4,
|
||||||
"cascadePower": 3,
|
"cascadePower": 2,
|
||||||
"shadows": 0,
|
"shadows": 0,
|
||||||
"granularity": 4,
|
"granularity": 4,
|
||||||
"extents": {
|
"extents": {
|
||||||
@ -58,7 +58,8 @@
|
|||||||
"framebuffer": {
|
"framebuffer": {
|
||||||
"size": 1,
|
"size": 1,
|
||||||
// "size": [ 640, 480, "NEAREST" ],
|
// "size": [ 640, 480, "NEAREST" ],
|
||||||
"msaa": 12
|
// "size": [ 1280, 720 ],
|
||||||
|
"msaa": 16
|
||||||
},
|
},
|
||||||
"experimental": {
|
"experimental": {
|
||||||
"rebuild on tick begin": false,
|
"rebuild on tick begin": false,
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
"air": 0.1,
|
"air": 0.1,
|
||||||
|
|
||||||
"crouch": 1,
|
"crouch": 1,
|
||||||
"jump": [ 0, 4, 0 ]
|
"jump": [ 0, 4, 0 ],
|
||||||
|
"look": 0.75
|
||||||
},
|
},
|
||||||
|
|
||||||
"gravity": [ 0, -9.81, 0 ],
|
"gravity": [ 0, -9.81, 0 ],
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"transform": {
|
"transform": {
|
||||||
"position": [ 0, -2.0, 0 ],
|
"position": [ 0, -2.0, 0 ],
|
||||||
// "position": [ 12.5715, 3.53811, 7.6238 ],
|
// "position": [ 12.5715, 3.53811, 7.6238 ],
|
||||||
|
// "position": [ 1.635, -0.384, -20.409 ], // -0.384
|
||||||
"rotation": {
|
"rotation": {
|
||||||
"axis": [ 0, 1, 0 ],
|
"axis": [ 0, 1, 0 ],
|
||||||
"angle": 0
|
"angle": 0
|
||||||
@ -34,7 +35,7 @@
|
|||||||
"print stats": false
|
"print stats": false
|
||||||
},
|
},
|
||||||
"export": {
|
"export": {
|
||||||
"should": false,
|
"should": true,
|
||||||
"pretty": false,
|
"pretty": false,
|
||||||
"compress": true,
|
"compress": true,
|
||||||
"quantize": false,
|
"quantize": false,
|
||||||
@ -44,18 +45,18 @@
|
|||||||
"unwrap": false
|
"unwrap": false
|
||||||
},
|
},
|
||||||
"animation": "wank",
|
"animation": "wank",
|
||||||
// "print animations": true,
|
"print animations": true,
|
||||||
|
// "filter": "NEAREST",
|
||||||
|
"cull mode": "none",
|
||||||
"flags": {
|
"flags": {
|
||||||
"ATLAS": false,
|
"ATLAS": false,
|
||||||
"SKINNED": true,
|
|
||||||
"INVERT": true,
|
"INVERT": true,
|
||||||
"TRANSFORM": false,
|
"TRANSFORM": false,
|
||||||
|
"SKINNED": true,
|
||||||
|
|
||||||
"RENDER": true,
|
"RENDER": true,
|
||||||
"COLLISION": false,
|
"SEPARATE": false,
|
||||||
"SEPARATE": true,
|
"NORMALS": false
|
||||||
"NORMALS": true,
|
|
||||||
"LOAD": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"model": {
|
"model": {
|
||||||
|
"cull mode": "none",
|
||||||
"tags": {
|
"tags": {
|
||||||
"worldspawn": { "physics": { "type": "mesh", "static": true } },
|
"worldspawn": { "physics": { "type": "mesh", "static": true } },
|
||||||
"info_player_spawn": { "action": "attach", "filename": "./player.json", "preserve orientation": true },
|
"info_player_spawn": { "action": "attach", "filename": "./player.json", "preserve orientation": true },
|
||||||
@ -17,13 +18,18 @@
|
|||||||
"func_door_rotating_5487": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5487": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5495": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5495": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5576": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_door_rotating_5576": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5584": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5584": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5656": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5656": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5664": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5664": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5689": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5689": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5698": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5698": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5712": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }
|
"func_door_rotating_5712": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
|
||||||
|
"func_physbox_5212": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_physbox_5548": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_physbox_5931": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"pause": "/gui/pause/menu.json"
|
"pause": "/gui/pause/menu.json"
|
||||||
},
|
},
|
||||||
"bloom": {
|
"bloom": {
|
||||||
"scale": 2.0,
|
"scale": 6.0,
|
||||||
"strength": 0.125,
|
"strength": 0.125,
|
||||||
"sigma": 0.125,
|
"sigma": 0.125,
|
||||||
"samples": 8
|
"samples": 8
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
"assets": ["./scripts/door.lua"],
|
"assets": ["./scripts/door.lua"],
|
||||||
"system": {
|
"system": {
|
||||||
"physics": {
|
"physics": {
|
||||||
"type": "bounding box"
|
"type": "bounding box",
|
||||||
|
"recenter": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,23 +8,30 @@
|
|||||||
{ "filename": "./models/sh_mcd/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
|
{ "filename": "./models/sh_mcd/graph.json.gz", "delay": 0, "single threaded": false, "category": "models" }
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"cull mode": "none",
|
|
||||||
"model": {
|
"model": {
|
||||||
|
"cull mode": "none",
|
||||||
|
"alpha mode": "BLEND",
|
||||||
"tags": {
|
"tags": {
|
||||||
"worldspawn": { "physics": { "type": "mesh", "static": true } },
|
"worldspawn": { "physics": { "type": "mesh", "static": true } },
|
||||||
|
"worldspawn_sh2": { "physics": { "type": "mesh", "static": true } },
|
||||||
"info_player_spawn": { "action": "attach", "filename": "./player.json", "preserve orientation": true },
|
"info_player_spawn": { "action": "attach", "filename": "./player.json", "preserve orientation": true },
|
||||||
|
|
||||||
"func_door_rotating_5409": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5409": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5487": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5487": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5495": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5495": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5576": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5568": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_door_rotating_5576": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5584": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5584": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5656": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
"func_door_rotating_5656": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle": 1.570795, "normal": [ 1,0,0] } } },
|
||||||
"func_door_rotating_5664": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5664": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5689": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5689": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5698": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
"func_door_rotating_5698": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
"func_door_rotating_5712": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }
|
"func_door_rotating_5712": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
|
||||||
|
"func_physbox_5212": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_physbox_5548": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } },
|
||||||
|
"func_physbox_5931": { "action": "load", "payload": { "import": "./door.json", "metadata": { "angle":-1.570795, "normal": [-1,0,0] } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,16 @@ bool validTextureIndex( uint start, int offset ) {
|
|||||||
uint textureIndex( uint start, int offset ) {
|
uint textureIndex( uint start, int offset ) {
|
||||||
return start + offset;
|
return start + offset;
|
||||||
}
|
}
|
||||||
|
#if TEXTURE_WORKAROUND
|
||||||
|
vec4 sampleTexture( uint id, vec2 uv ) {
|
||||||
|
const Texture t = textures[id];
|
||||||
|
return texture( samplerTextures[nonuniformEXT(t.index - surface.instance.imageID)], mix( t.lerp.xy, t.lerp.zw, uv ) );
|
||||||
|
}
|
||||||
|
vec4 sampleTexture( uint id, vec2 uv, float mip ) {
|
||||||
|
const Texture t = textures[id];
|
||||||
|
return textureLod( samplerTextures[nonuniformEXT(t.index - surface.instance.imageID)], mix( t.lerp.xy, t.lerp.zw, uv ), mip );
|
||||||
|
}
|
||||||
|
#else
|
||||||
vec4 sampleTexture( uint id, vec2 uv ) {
|
vec4 sampleTexture( uint id, vec2 uv ) {
|
||||||
const Texture t = textures[id];
|
const Texture t = textures[id];
|
||||||
return texture( samplerTextures[nonuniformEXT(t.index)], mix( t.lerp.xy, t.lerp.zw, uv ) );
|
return texture( samplerTextures[nonuniformEXT(t.index)], mix( t.lerp.xy, t.lerp.zw, uv ) );
|
||||||
@ -61,6 +71,7 @@ vec4 sampleTexture( uint id, vec2 uv, float mip ) {
|
|||||||
const Texture t = textures[id];
|
const Texture t = textures[id];
|
||||||
return textureLod( samplerTextures[nonuniformEXT(t.index)], mix( t.lerp.xy, t.lerp.zw, uv ), mip );
|
return textureLod( samplerTextures[nonuniformEXT(t.index)], mix( t.lerp.xy, t.lerp.zw, uv ), mip );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
vec4 sampleTexture( uint id ) { return sampleTexture( id, surface.uv ); }
|
vec4 sampleTexture( uint id ) { return sampleTexture( id, surface.uv ); }
|
||||||
vec4 sampleTexture( uint id, float mip ) { return sampleTexture( id, surface.uv, mip ); }
|
vec4 sampleTexture( uint id, float mip ) { return sampleTexture( id, surface.uv, mip ); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,7 @@ float gaSchlickGGX(float cosLi, float cosLo, float roughness) {
|
|||||||
vec3 fresnelSchlick(vec3 F0, float cosTheta) { return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); }
|
vec3 fresnelSchlick(vec3 F0, float cosTheta) { return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); }
|
||||||
#if !BAKING
|
#if !BAKING
|
||||||
void pbr() {
|
void pbr() {
|
||||||
if ( validTextureIndex( surface.material.lightmapID ) ) return;
|
if ( validTextureIndex( surface.instance.lightmapID ) ) return;
|
||||||
|
|
||||||
const float Rs = 4.0; // specular lighting looks gross without this
|
const float Rs = 4.0; // specular lighting looks gross without this
|
||||||
const vec3 F0 = mix(vec3(0.04), surface.material.albedo.rgb, surface.material.metallic);
|
const vec3 F0 = mix(vec3(0.04), surface.material.albedo.rgb, surface.material.metallic);
|
||||||
@ -43,7 +43,7 @@ void pbr() {
|
|||||||
const vec3 diffuse = mix( vec3(1.0) - F, vec3(0.0), surface.material.metallic ) * surface.material.albedo.rgb;
|
const vec3 diffuse = mix( vec3(1.0) - F, vec3(0.0), surface.material.metallic ) * surface.material.albedo.rgb;
|
||||||
const vec3 specular = (F * D * G) / max(EPSILON, 4.0 * cosLi * cosLo);
|
const vec3 specular = (F * D * G) / max(EPSILON, 4.0 * cosLi * cosLo);
|
||||||
// lightmapped, compute only specular
|
// lightmapped, compute only specular
|
||||||
if ( light.type >= 0 && validTextureIndex( surface.material.lightmapID ) ) surface.fragment.rgb += (specular) * Lr * cosLi;
|
if ( light.type >= 0 && validTextureIndex( surface.instance.lightmapID ) ) surface.fragment.rgb += (specular) * Lr * cosLi;
|
||||||
// point light, compute only diffuse
|
// point light, compute only diffuse
|
||||||
// else if ( abs(light.type) == 1 ) surface.fragment.rgb += (diffuse) * Lr * cosLi;
|
// else if ( abs(light.type) == 1 ) surface.fragment.rgb += (diffuse) * Lr * cosLi;
|
||||||
else surface.fragment.rgb += (diffuse + specular) * Lr * cosLi;
|
else surface.fragment.rgb += (diffuse + specular) * Lr * cosLi;
|
||||||
|
@ -130,22 +130,20 @@ struct Instance {
|
|||||||
|
|
||||||
int jointID;
|
int jointID;
|
||||||
int lightmapID;
|
int lightmapID;
|
||||||
uint padding1;
|
uint imageID;
|
||||||
uint padding2;
|
uint padding2;
|
||||||
|
|
||||||
Bounds bounds;
|
Bounds bounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SurfaceMaterial {
|
struct SurfaceMaterial {
|
||||||
uint id;
|
|
||||||
|
|
||||||
vec4 albedo;
|
vec4 albedo;
|
||||||
vec4 indirect;
|
vec4 indirect;
|
||||||
|
|
||||||
float metallic;
|
float metallic;
|
||||||
float roughness;
|
float roughness;
|
||||||
float occlusion;
|
float occlusion;
|
||||||
uint lightmapID;
|
uint padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Surface {
|
struct Surface {
|
||||||
@ -158,6 +156,7 @@ struct Surface {
|
|||||||
Ray ray;
|
Ray ray;
|
||||||
|
|
||||||
SurfaceMaterial material;
|
SurfaceMaterial material;
|
||||||
|
Instance instance;
|
||||||
|
|
||||||
vec4 fragment;
|
vec4 fragment;
|
||||||
} surface;
|
} surface;
|
||||||
|
@ -175,7 +175,7 @@ void indirectLighting() {
|
|||||||
Ray ray;
|
Ray ray;
|
||||||
ray.direction = surface.ray.direction;
|
ray.direction = surface.ray.direction;
|
||||||
ray.origin = surface.position.world; // + ray.direction;
|
ray.origin = surface.position.world; // + ray.direction;
|
||||||
vec4 radiance = voxelConeTrace( ray, surface.material.albedo.a );
|
vec4 radiance = voxelConeTrace( ray, surface.material.albedo.a * 0.5 );
|
||||||
surface.fragment.rgb += (1.0 - surface.material.albedo.a) * radiance.rgb;
|
surface.fragment.rgb += (1.0 - surface.material.albedo.a) * radiance.rgb;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -184,10 +184,11 @@ void populateSurface() {
|
|||||||
}
|
}
|
||||||
// const DrawCommand drawCommand = drawCommands[drawID];
|
// const DrawCommand drawCommand = drawCommands[drawID];
|
||||||
const Instance instance = instances[instanceID];
|
const Instance instance = instances[instanceID];
|
||||||
surface.material.id = instance.materialID;
|
surface.instance = instance;
|
||||||
surface.material.lightmapID = instance.lightmapID;
|
// surface.instance.materialID = instance.materialID;
|
||||||
|
// surface.instance.lightmapID = instance.lightmapID;
|
||||||
|
|
||||||
const Material material = materials[surface.material.id];
|
const Material material = materials[surface.instance.materialID];
|
||||||
surface.material.albedo = material.colorBase;
|
surface.material.albedo = material.colorBase;
|
||||||
surface.material.metallic = material.factorMetallic;
|
surface.material.metallic = material.factorMetallic;
|
||||||
surface.material.roughness = material.factorRoughness;
|
surface.material.roughness = material.factorRoughness;
|
||||||
@ -219,8 +220,8 @@ void populateSurface() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Lightmap
|
// Lightmap
|
||||||
if ( validTextureIndex( surface.material.lightmapID ) ) {
|
if ( validTextureIndex( surface.instance.lightmapID ) ) {
|
||||||
surface.material.albedo.rgb *= sampleTexture( surface.material.lightmapID, surface.st ).rgb;
|
surface.material.albedo.rgb *= sampleTexture( surface.instance.lightmapID, surface.st ).rgb;
|
||||||
}
|
}
|
||||||
// Emissive textures
|
// Emissive textures
|
||||||
if ( validTextureIndex( material.indexEmissive ) ) {
|
if ( validTextureIndex( material.indexEmissive ) ) {
|
||||||
@ -249,7 +250,7 @@ void directLighting() {
|
|||||||
const vec3 ambient = ubo.ambient.rgb * surface.material.occlusion + surface.material.indirect.rgb;
|
const vec3 ambient = ubo.ambient.rgb * surface.material.occlusion + surface.material.indirect.rgb;
|
||||||
// surface.fragment.rgb += surface.material.albedo.rgb * ambient;
|
// surface.fragment.rgb += surface.material.albedo.rgb * ambient;
|
||||||
|
|
||||||
if ( validTextureIndex( surface.material.lightmapID ) ) {
|
if ( validTextureIndex( surface.instance.lightmapID ) ) {
|
||||||
surface.fragment.rgb += surface.material.albedo.rgb + ambient;
|
surface.fragment.rgb += surface.material.albedo.rgb + ambient;
|
||||||
} else {
|
} else {
|
||||||
surface.fragment.rgb += surface.material.albedo.rgb * ambient;
|
surface.fragment.rgb += surface.material.albedo.rgb * ambient;
|
||||||
|
@ -92,12 +92,10 @@ void main() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// const DrawCommand drawCommand = drawCommands[drawID];
|
// const DrawCommand drawCommand = drawCommands[drawID];
|
||||||
const Instance instance = instances[instanceID];
|
surface.instance = instances[instanceID];
|
||||||
surface.material.id = instance.materialID;
|
const Material material = materials[surface.instance.materialID];
|
||||||
const Material material = materials[surface.material.id];
|
|
||||||
surface.material.albedo = material.colorBase;
|
surface.material.albedo = material.colorBase;
|
||||||
surface.fragment = material.colorEmissive;
|
surface.fragment = material.colorEmissive;
|
||||||
surface.material.lightmapID = instance.lightmapID;
|
|
||||||
#if DEFERRED_SAMPLING
|
#if DEFERRED_SAMPLING
|
||||||
{
|
{
|
||||||
vec4 uv = imageLoad(voxelUv[CASCADE], ivec3(tUvw) );
|
vec4 uv = imageLoad(voxelUv[CASCADE], ivec3(tUvw) );
|
||||||
@ -119,8 +117,8 @@ void main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Lightmap
|
// Lightmap
|
||||||
if ( validTextureIndex( surface.material.lightmapID ) ) {
|
if ( validTextureIndex( surface.instance.lightmapID ) ) {
|
||||||
surface.material.albedo.rgb *= sampleTexture( surface.material.lightmapID, surface.st ).rgb;
|
surface.material.albedo.rgb *= sampleTexture( surface.instance.lightmapID, surface.st ).rgb;
|
||||||
}
|
}
|
||||||
// Emissive textures
|
// Emissive textures
|
||||||
if ( validTextureIndex( material.indexEmissive ) ) {
|
if ( validTextureIndex( material.indexEmissive ) ) {
|
||||||
@ -134,14 +132,14 @@ void main() {
|
|||||||
surface.material.occlusion = material.factorOcclusion;
|
surface.material.occlusion = material.factorOcclusion;
|
||||||
|
|
||||||
float litFactor = 1.0;
|
float litFactor = 1.0;
|
||||||
if ( validTextureIndex( surface.material.lightmapID ) ) {
|
if ( validTextureIndex( surface.instance.lightmapID ) ) {
|
||||||
surface.fragment.rgb += surface.material.albedo.rgb + ubo.ambient.rgb * surface.material.occlusion;
|
surface.fragment.rgb += surface.material.albedo.rgb + ubo.ambient.rgb * surface.material.occlusion;
|
||||||
} else {
|
} else {
|
||||||
surface.fragment.rgb += surface.material.albedo.rgb * ubo.ambient.rgb * surface.material.occlusion;
|
surface.fragment.rgb += surface.material.albedo.rgb * ubo.ambient.rgb * surface.material.occlusion;
|
||||||
}
|
}
|
||||||
// corrections
|
// corrections
|
||||||
surface.material.roughness *= 4.0;
|
surface.material.roughness *= 4.0;
|
||||||
if ( !validTextureIndex( surface.material.lightmapID ) )
|
if ( !validTextureIndex( surface.instance.lightmapID ) )
|
||||||
{
|
{
|
||||||
const vec3 F0 = mix(vec3(0.04), surface.material.albedo.rgb, surface.material.metallic);
|
const vec3 F0 = mix(vec3(0.04), surface.material.albedo.rgb, surface.material.metallic);
|
||||||
const vec3 Lo = normalize( surface.position.world );
|
const vec3 Lo = normalize( surface.position.world );
|
||||||
@ -149,7 +147,7 @@ void main() {
|
|||||||
for ( uint i = 0; i < ubo.lights; ++i ) {
|
for ( uint i = 0; i < ubo.lights; ++i ) {
|
||||||
const Light light = lights[i];
|
const Light light = lights[i];
|
||||||
if ( light.power <= LIGHT_POWER_CUTOFF ) continue;
|
if ( light.power <= LIGHT_POWER_CUTOFF ) continue;
|
||||||
if ( light.type >= 0 && validTextureIndex( surface.material.lightmapID ) ) continue;
|
if ( light.type >= 0 && validTextureIndex( surface.instance.lightmapID ) ) continue;
|
||||||
const vec3 Lp = light.position;
|
const vec3 Lp = light.position;
|
||||||
const vec3 Liu = light.position - surface.position.world;
|
const vec3 Liu = light.position - surface.position.world;
|
||||||
const vec3 Li = normalize(Liu);
|
const vec3 Li = normalize(Liu);
|
||||||
@ -173,7 +171,7 @@ void main() {
|
|||||||
const vec3 specular = (F * D * G) / max(EPSILON, 4.0 * cosLi * cosLo);
|
const vec3 specular = (F * D * G) / max(EPSILON, 4.0 * cosLi * cosLo);
|
||||||
#endif
|
#endif
|
||||||
// lightmapped, compute only specular
|
// lightmapped, compute only specular
|
||||||
if ( light.type >= 0 && validTextureIndex( surface.material.lightmapID ) ) surface.fragment.rgb += (specular) * Lr * cosLi;
|
if ( light.type >= 0 && validTextureIndex( surface.instance.lightmapID ) ) surface.fragment.rgb += (specular) * Lr * cosLi;
|
||||||
// point light, compute only diffuse
|
// point light, compute only diffuse
|
||||||
// else if ( abs(light.type) == 1 ) surface.fragment.rgb += (diffuse) * Lr * cosLi;
|
// else if ( abs(light.type) == 1 ) surface.fragment.rgb += (diffuse) * Lr * cosLi;
|
||||||
else surface.fragment.rgb += (diffuse + specular) * Lr * cosLi;
|
else surface.fragment.rgb += (diffuse + specular) * Lr * cosLi;
|
||||||
|
@ -57,8 +57,7 @@ void main() {
|
|||||||
surface.normal.world = normalize( inNormal );
|
surface.normal.world = normalize( inNormal );
|
||||||
surface.uv = wrap(inUv.xy);
|
surface.uv = wrap(inUv.xy);
|
||||||
surface.position.world = inPosition;
|
surface.position.world = inPosition;
|
||||||
surface.material.id = materialID;
|
const Material material = materials[materialID];
|
||||||
const Material material = materials[surface.material.id];
|
|
||||||
|
|
||||||
surface.material.metallic = material.factorMetallic;
|
surface.material.metallic = material.factorMetallic;
|
||||||
surface.material.roughness = material.factorRoughness;
|
surface.material.roughness = material.factorRoughness;
|
||||||
|
@ -72,7 +72,7 @@ void main() {
|
|||||||
const mat4 projection = camera.viewport[PushConstant.pass].projection;
|
const mat4 projection = camera.viewport[PushConstant.pass].projection;
|
||||||
#endif
|
#endif
|
||||||
#if SKINNED
|
#if SKINNED
|
||||||
const mat4 skinned = joints.length() <= 0 ? mat4(1.0) : inWeights.x * joints[jointID + int(inJoints.x)] + inWeights.y * joints[jointID + int(inJoints.y)] + inWeights.z * joints[jointID + int(inJoints.z)] + inWeights.w * joints[jointID + int(inJoints.w)];
|
const mat4 skinned = joints.length() <= 0 || jointID < 0 ? mat4(1.0) : inWeights.x * joints[jointID + int(inJoints.x)] + inWeights.y * joints[jointID + int(inJoints.y)] + inWeights.z * joints[jointID + int(inJoints.z)] + inWeights.w * joints[jointID + int(inJoints.w)];
|
||||||
#else
|
#else
|
||||||
const mat4 skinned = mat4(1.0);
|
const mat4 skinned = mat4(1.0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define BLEND 1
|
#define BLEND 1
|
||||||
#define DEPTH_TEST 0
|
#define DEPTH_TEST 0
|
||||||
#define CUBEMAPS 1
|
#define CUBEMAPS 1
|
||||||
|
#define TEXTURE_WORKAROUND 1
|
||||||
layout (constant_id = 0) const uint TEXTURES = 512;
|
layout (constant_id = 0) const uint TEXTURES = 512;
|
||||||
layout (constant_id = 1) const uint CASCADES = 16;
|
layout (constant_id = 1) const uint CASCADES = 16;
|
||||||
|
|
||||||
@ -57,27 +58,33 @@ void main() {
|
|||||||
const vec3 P = inPosition.xzy * 0.5 + 0.5;
|
const vec3 P = inPosition.xzy * 0.5 + 0.5;
|
||||||
if ( abs(P.x) > 1 || abs(P.y) > 1 || abs(P.z) > 1 ) discard;
|
if ( abs(P.x) > 1 || abs(P.y) > 1 || abs(P.z) > 1 ) discard;
|
||||||
|
|
||||||
vec4 A = vec4(0, 0, 0, 0);
|
const uint drawID = uint(inId.x);
|
||||||
const vec3 N = inNormal;
|
const uint instanceID = uint(inId.y);
|
||||||
|
const uint materialID = uint(inId.z);
|
||||||
|
const float mip = mipLevel(inUv.xy);
|
||||||
const vec2 uv = wrap(inUv.xy);
|
const vec2 uv = wrap(inUv.xy);
|
||||||
const float mip = 0; // mipLevel(inUv.xy);
|
|
||||||
const uint drawID = int(inId.x);
|
surface.uv = uv;
|
||||||
const uint instanceID = int(inId.y);
|
surface.st = inSt;
|
||||||
const uint materialID = int(inId.z);
|
vec3 N = inNormal;
|
||||||
|
vec4 A = vec4(0, 0, 0, 0);
|
||||||
|
|
||||||
const Instance instance = instances[instanceID];
|
const Instance instance = instances[instanceID];
|
||||||
const Material material = materials[materialID];
|
const Material material = materials[materialID];
|
||||||
surface.uv = uv;
|
surface.instance = instance;
|
||||||
surface.st = inSt.xy;
|
|
||||||
|
|
||||||
const float M = material.factorMetallic;
|
float M = material.factorMetallic;
|
||||||
const float R = material.factorRoughness;
|
float R = material.factorRoughness;
|
||||||
const float AO = material.factorOcclusion;
|
float AO = material.factorOcclusion;
|
||||||
|
|
||||||
// sample albedo
|
// sample albedo
|
||||||
if ( !validTextureIndex( material.indexAlbedo ) ) discard; {
|
if ( !validTextureIndex( material.indexAlbedo ) ) discard; {
|
||||||
// const Texture t = textures[material.indexAlbedo];
|
if ( surface.instance.imageID <= 0 ) {
|
||||||
// A = textureLod( samplerTextures[nonuniformEXT(t.index)], mix( t.lerp.xy, t.lerp.zw, uv ), mip );
|
A = sampleTexture( material.indexAlbedo, mip );
|
||||||
A = sampleTexture( material.indexAlbedo, mip );
|
} else {
|
||||||
|
const Texture t = textures[material.indexAlbedo];
|
||||||
|
A = texture( samplerTextures[nonuniformEXT(t.index - surface.instance.imageID)], mix( t.lerp.xy, t.lerp.zw, uv ) );
|
||||||
|
}
|
||||||
// alpha mode OPAQUE
|
// alpha mode OPAQUE
|
||||||
if ( material.modeAlpha == 0 ) {
|
if ( material.modeAlpha == 0 ) {
|
||||||
A.a = 1;
|
A.a = 1;
|
||||||
@ -93,7 +100,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
#if USE_LIGHTMAP && !DEFERRED_SAMPLING
|
#if USE_LIGHTMAP && !DEFERRED_SAMPLING
|
||||||
if ( validTextureIndex( instance.lightmapID ) ) {
|
if ( validTextureIndex( instance.lightmapID ) ) {
|
||||||
A.rgb *= sampleTexture( instance.lightmapID, inSt, mip ).rgb;
|
// A.rgb *= sampleTexture( instance.lightmapID, inSt, mip ).rgb;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -114,6 +121,6 @@ void main() {
|
|||||||
const vec4 dst = imageLoad(voxelRadiance[CASCADE], uvw);
|
const vec4 dst = imageLoad(voxelRadiance[CASCADE], uvw);
|
||||||
imageStore(voxelRadiance[CASCADE], uvw, blend( src, dst, src.a ) );
|
imageStore(voxelRadiance[CASCADE], uvw, blend( src, dst, src.a ) );
|
||||||
#else
|
#else
|
||||||
imageStore(voxelRadiance[CASCADE], uvw, A * inColor );
|
imageStore(voxelRadiance[CASCADE], uvw, A );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ namespace pod {
|
|||||||
|
|
||||||
alignas(4) int32_t jointID = -1;
|
alignas(4) int32_t jointID = -1;
|
||||||
alignas(4) int32_t lightmapID = -1;
|
alignas(4) int32_t lightmapID = -1;
|
||||||
alignas(4) uint32_t padding2 = 0;
|
alignas(4) uint32_t imageID = 0;
|
||||||
alignas(4) uint32_t padding3 = 0;
|
alignas(4) uint32_t padding3 = 0;
|
||||||
|
|
||||||
struct Bounds {
|
struct Bounds {
|
||||||
|
@ -65,6 +65,10 @@ namespace {
|
|||||||
{
|
{
|
||||||
for ( auto& i : graph.images ) graphic.material.textures.emplace_back().aliasTexture( uf::graph::storage.texture2Ds.map[i] );
|
for ( auto& i : graph.images ) graphic.material.textures.emplace_back().aliasTexture( uf::graph::storage.texture2Ds.map[i] );
|
||||||
for ( auto& s : graph.samplers ) graphic.material.samplers.emplace_back( uf::graph::storage.samplers.map[s] );
|
for ( auto& s : graph.samplers ) graphic.material.samplers.emplace_back( uf::graph::storage.samplers.map[s] );
|
||||||
|
|
||||||
|
// for ( auto pair : uf::graph::storage.texture2Ds.map ) graphic.material.textures.emplace_back().aliasTexture( pair.second );
|
||||||
|
// for ( auto pair : uf::graph::storage.samplers.map ) graphic.material.samplers.emplace_back( pair.second );
|
||||||
|
|
||||||
// bind scene's voxel texture
|
// bind scene's voxel texture
|
||||||
if ( uf::renderer::settings::experimental::vxgi ) {
|
if ( uf::renderer::settings::experimental::vxgi ) {
|
||||||
auto& scene = uf::scene::getCurrentScene();
|
auto& scene = uf::scene::getCurrentScene();
|
||||||
@ -441,7 +445,7 @@ void uf::graph::process( pod::Graph& graph ) {
|
|||||||
UF_ASSERT( it != keys.end() );
|
UF_ASSERT( it != keys.end() );
|
||||||
texture.index = it - keys.begin();
|
texture.index = it - keys.begin();
|
||||||
}
|
}
|
||||||
// remap instance materials
|
// remap instance variables
|
||||||
for ( auto& name : graph.instances ) {
|
for ( auto& name : graph.instances ) {
|
||||||
auto& instance = uf::graph::storage.instances[name];
|
auto& instance = uf::graph::storage.instances[name];
|
||||||
|
|
||||||
@ -451,6 +455,12 @@ void uf::graph::process( pod::Graph& graph ) {
|
|||||||
UF_ASSERT( it != keys.end() );
|
UF_ASSERT( it != keys.end() );
|
||||||
instance.materialID = it - keys.begin();
|
instance.materialID = it - keys.begin();
|
||||||
}
|
}
|
||||||
|
if ( 0 <= instance.imageID && instance.imageID < graph.images.size() ) {
|
||||||
|
auto& keys = /*graph.storage*/uf::graph::storage.images.keys;
|
||||||
|
auto it = std::find( keys.begin(), keys.end(), graph.images[instance.imageID] );
|
||||||
|
UF_ASSERT( it != keys.end() );
|
||||||
|
instance.imageID = it - keys.begin();
|
||||||
|
}
|
||||||
// remap a skinID as an actual jointID
|
// remap a skinID as an actual jointID
|
||||||
if ( 0 <= instance.jointID && instance.jointID < graph.skins.size() ) {
|
if ( 0 <= instance.jointID && instance.jointID < graph.skins.size() ) {
|
||||||
auto& name = graph.skins[instance.jointID];
|
auto& name = graph.skins[instance.jointID];
|
||||||
@ -653,6 +663,7 @@ void uf::graph::process( pod::Graph& graph, int32_t index, uf::Object& parent )
|
|||||||
|
|
||||||
instance.model = model;
|
instance.model = model;
|
||||||
instance.objectID = objectID;
|
instance.objectID = objectID;
|
||||||
|
instance.jointID = graph.metadata["flags"]["SKINNED"].as<bool>() ? 0 : -1;
|
||||||
|
|
||||||
bounds.min = uf::vector::min( bounds.min, instance.bounds.min );
|
bounds.min = uf::vector::min( bounds.min, instance.bounds.min );
|
||||||
bounds.max = uf::vector::max( bounds.max, instance.bounds.max );
|
bounds.max = uf::vector::max( bounds.max, instance.bounds.max );
|
||||||
|
@ -139,7 +139,7 @@ void ext::bullet::initialize() {
|
|||||||
mesh.bind<VertexLine>();
|
mesh.bind<VertexLine>();
|
||||||
|
|
||||||
#if !UF_ENV_DREAMCAST
|
#if !UF_ENV_DREAMCAST
|
||||||
// gContactAddedCallback = contactCallback;
|
gContactAddedCallback = contactCallback;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void ext::bullet::tick( float delta ) { if ( delta == 0.0f ) delta = uf::physics::time::delta;
|
void ext::bullet::tick( float delta ) { if ( delta == 0.0f ) delta = uf::physics::time::delta;
|
||||||
@ -355,8 +355,10 @@ pod::Bullet& ext::bullet::create( uf::Object& object, const uf::Mesh& mesh, bool
|
|||||||
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
|
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
|
||||||
triangleInfoMap->m_edgeDistanceThreshold = 0.01f;
|
triangleInfoMap->m_edgeDistanceThreshold = 0.01f;
|
||||||
triangleInfoMap->m_maxEdgeAngleThreshold = SIMD_HALF_PI*0.25;
|
triangleInfoMap->m_maxEdgeAngleThreshold = SIMD_HALF_PI*0.25;
|
||||||
if ( !false ) btGenerateInternalEdgeInfo( triangleMeshShape, triangleInfoMap );
|
if ( !false ) {
|
||||||
collider.body->setCollisionFlags(collider.body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
|
btGenerateInternalEdgeInfo( triangleMeshShape, triangleInfoMap );
|
||||||
|
collider.body->setCollisionFlags(collider.body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
|
||||||
|
}
|
||||||
return collider;
|
return collider;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -142,7 +142,7 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
auto imageID = graph.images.size();
|
auto imageID = graph.images.size();
|
||||||
auto keyName = graph.images.emplace_back(filename + "/" + i.name);
|
auto keyName = graph.images.emplace_back(filename + "/" + i.name);
|
||||||
auto& image = /*graph.storage*/uf::graph::storage.images[keyName];
|
auto& image = /*graph.storage*/uf::graph::storage.images[keyName];
|
||||||
image.loadFromBuffer( &i.image[0], {i.width, i.height}, 8, i.component, true );
|
image.loadFromBuffer( &i.image[0], {i.width, i.height}, 8, i.component, graph.metadata["flip textures"].as<bool>(true) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// load samplers
|
// load samplers
|
||||||
@ -207,10 +207,11 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
material.factorOcclusion = m.occlusionTexture.strength;
|
material.factorOcclusion = m.occlusionTexture.strength;
|
||||||
material.factorAlphaCutoff = m.alphaCutoff;
|
material.factorAlphaCutoff = m.alphaCutoff;
|
||||||
|
|
||||||
if ( m.alphaMode == "OPAQUE" ) material.modeAlpha = 0;
|
const uf::stl::string mode = graph.metadata["alpha mode"].as<uf::stl::string>(m.alphaMode);
|
||||||
else if ( m.alphaMode == "BLEND" ) material.modeAlpha = 1;
|
if ( mode == "OPAQUE" ) material.modeAlpha = 0;
|
||||||
else if ( m.alphaMode == "MASK" ) material.modeAlpha = 2;
|
else if ( mode == "BLEND" ) material.modeAlpha = 1;
|
||||||
else UF_MSG_WARNING("Unhandled alpha mode: " << m.alphaMode);
|
else if ( mode == "MASK" ) material.modeAlpha = 2;
|
||||||
|
else UF_MSG_WARNING("Unhandled alpha mode: " << mode);
|
||||||
|
|
||||||
if ( m.doubleSided && graph.metadata["cull mode"].as<uf::stl::string>() == "auto" ) {
|
if ( m.doubleSided && graph.metadata["cull mode"].as<uf::stl::string>() == "auto" ) {
|
||||||
graph.metadata["cull mode"] = "none";
|
graph.metadata["cull mode"] = "none";
|
||||||
@ -248,9 +249,15 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
|
|
||||||
struct Attribute {
|
struct Attribute {
|
||||||
uf::stl::string name = "";
|
uf::stl::string name = "";
|
||||||
size_t components = 1;
|
size_t components = 0;
|
||||||
|
size_t length = 0;
|
||||||
|
size_t stride = 0;
|
||||||
|
uint8_t* buffer = NULL;
|
||||||
|
|
||||||
uf::stl::vector<float> floats;
|
uf::stl::vector<float> floats;
|
||||||
uf::stl::vector<uint16_t> ints;
|
uf::stl::vector<uint8_t> int8s;
|
||||||
|
uf::stl::vector<uint16_t> int16s;
|
||||||
|
uf::stl::vector<uint32_t> int32s;
|
||||||
};
|
};
|
||||||
|
|
||||||
uf::stl::unordered_map<uf::stl::string, Attribute> attributes = {
|
uf::stl::unordered_map<uf::stl::string, Attribute> attributes = {
|
||||||
@ -281,28 +288,87 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
primitive.instance.bounds.max.x = -primitive.instance.bounds.max.x;
|
primitive.instance.bounds.max.x = -primitive.instance.bounds.max.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( attribute.name == "JOINTS_0" ) {
|
|
||||||
auto* buffer = reinterpret_cast<const uint16_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
#if 0
|
||||||
attribute.components = accessor.ByteStride(view) / sizeof(uint16_t);
|
switch ( accessor.componentType ) {
|
||||||
size_t len = accessor.count * attribute.components;
|
case TINYGLTF_COMPONENT_TYPE_BYTE:
|
||||||
attribute.ints.assign( &buffer[0], &buffer[len] );
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE: {
|
||||||
} else {
|
attribute.stride = sizeof(uint8_t);
|
||||||
auto* buffer = reinterpret_cast<const float*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
} break;
|
||||||
attribute.components = accessor.ByteStride(view) / sizeof(float);
|
case TINYGLTF_COMPONENT_TYPE_SHORT:
|
||||||
size_t len = accessor.count * attribute.components;
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT: {
|
||||||
attribute.floats.assign( &buffer[0], &buffer[len] );
|
attribute.stride = sizeof(uint16_t);
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_INT:
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT: {
|
||||||
|
attribute.stride = sizeof(uint32_t);
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_FLOAT: {
|
||||||
|
attribute.stride = sizeof(float);
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_DOUBLE: {
|
||||||
|
attribute.stride = sizeof(double);
|
||||||
|
} break;
|
||||||
|
default: UF_MSG_ERROR("Unsupported component type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attribute.buffer = &(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]);
|
||||||
|
attribute.components = accessor.ByteStride(view) / attribute.stride;
|
||||||
|
attribute.length = accessor.count * attribute.components;
|
||||||
|
#else
|
||||||
|
switch ( accessor.componentType ) {
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_BYTE:
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE: {
|
||||||
|
auto* buffer = reinterpret_cast<const uint8_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(uint8_t);
|
||||||
|
attribute.length = accessor.count * attribute.components;
|
||||||
|
attribute.int8s.assign( &buffer[0], &buffer[attribute.length] );
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_SHORT:
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT: {
|
||||||
|
auto* buffer = reinterpret_cast<const uint16_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(uint16_t);
|
||||||
|
attribute.length = accessor.count * attribute.components;
|
||||||
|
attribute.int16s.assign( &buffer[0], &buffer[attribute.length] );
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_INT:
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT: {
|
||||||
|
auto* buffer = reinterpret_cast<const uint32_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(uint32_t);
|
||||||
|
attribute.length = accessor.count * attribute.components;
|
||||||
|
attribute.int32s.assign( &buffer[0], &buffer[attribute.length] );
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_FLOAT: {
|
||||||
|
auto* buffer = reinterpret_cast<const float*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(float);
|
||||||
|
attribute.length = accessor.count * attribute.components;
|
||||||
|
attribute.floats.assign( &buffer[0], &buffer[attribute.length] );
|
||||||
|
} break;
|
||||||
|
default: UF_MSG_ERROR("Unsupported component type");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( size_t i = 0; i < vertices.size(); ++i ) {
|
for ( size_t i = 0; i < vertices.size(); ++i ) {
|
||||||
|
#if 0
|
||||||
#define ITERATE_ATTRIBUTE( name, member )\
|
#define ITERATE_ATTRIBUTE( name, member )\
|
||||||
if ( !attributes[name].ints.empty() ) { \
|
memcpy( &vertex.member[0], &attributes[name].buffer[i * attributes[name].components], attributes[name].stride );
|
||||||
|
#else
|
||||||
|
#define ITERATE_ATTRIBUTE( name, member )\
|
||||||
|
if ( !attributes[name].int8s.empty() ) { \
|
||||||
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
vertex.member[j] = attributes[name].ints[i * attributes[name].components + j];\
|
vertex.member[j] = attributes[name].int8s[i * attributes[name].components + j];\
|
||||||
|
} else if ( !attributes[name].int16s.empty() ) { \
|
||||||
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
|
vertex.member[j] = attributes[name].int16s[i * attributes[name].components + j];\
|
||||||
|
} else if ( !attributes[name].int32s.empty() ) { \
|
||||||
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
|
vertex.member[j] = attributes[name].int32s[i * attributes[name].components + j];\
|
||||||
} else if ( !attributes[name].floats.empty() ) { \
|
} else if ( !attributes[name].floats.empty() ) { \
|
||||||
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
vertex.member[j] = attributes[name].floats[i * attributes[name].components + j];\
|
vertex.member[j] = attributes[name].floats[i * attributes[name].components + j];\
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
auto& vertex = vertices[i];
|
auto& vertex = vertices[i];
|
||||||
ITERATE_ATTRIBUTE("POSITION", position);
|
ITERATE_ATTRIBUTE("POSITION", position);
|
||||||
@ -392,7 +458,9 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
uf::stl::string name = "";
|
uf::stl::string name = "";
|
||||||
size_t components = 1;
|
size_t components = 1;
|
||||||
uf::stl::vector<float> floats;
|
uf::stl::vector<float> floats;
|
||||||
uf::stl::vector<uint16_t> ints;
|
uf::stl::vector<uint8_t> int8s;
|
||||||
|
uf::stl::vector<uint16_t> int16s;
|
||||||
|
uf::stl::vector<uint32_t> int32s;
|
||||||
};
|
};
|
||||||
|
|
||||||
uf::stl::unordered_map<uf::stl::string, Attribute> attributes = {
|
uf::stl::unordered_map<uf::stl::string, Attribute> attributes = {
|
||||||
@ -420,24 +488,49 @@ pod::Graph ext::gltf::load( const uf::stl::string& filename, const uf::Serialize
|
|||||||
primitive.instance.bounds.max.x = -primitive.instance.bounds.max.x;
|
primitive.instance.bounds.max.x = -primitive.instance.bounds.max.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( attribute.name == "JOINTS_0" ) {
|
switch ( accessor.componentType ) {
|
||||||
auto* buffer = reinterpret_cast<const uint16_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
case TINYGLTF_COMPONENT_TYPE_BYTE:
|
||||||
attribute.components = accessor.ByteStride(view) / sizeof(uint16_t);
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE: {
|
||||||
size_t len = accessor.count * attribute.components;
|
auto* buffer = reinterpret_cast<const uint8_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
attribute.ints.assign( &buffer[0], &buffer[len] );
|
attribute.components = accessor.ByteStride(view) / sizeof(uint8_t);
|
||||||
} else {
|
size_t len = accessor.count * attribute.components;
|
||||||
auto* buffer = reinterpret_cast<const float*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
attribute.int8s.assign( &buffer[0], &buffer[len] );
|
||||||
attribute.components = accessor.ByteStride(view) / sizeof(float);
|
} break;
|
||||||
size_t len = accessor.count * attribute.components;
|
case TINYGLTF_COMPONENT_TYPE_SHORT:
|
||||||
attribute.floats.assign( &buffer[0], &buffer[len] );
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_SHORT: {
|
||||||
|
auto* buffer = reinterpret_cast<const uint16_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(uint16_t);
|
||||||
|
size_t len = accessor.count * attribute.components;
|
||||||
|
attribute.int16s.assign( &buffer[0], &buffer[len] );
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_INT:
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT: {
|
||||||
|
auto* buffer = reinterpret_cast<const uint32_t*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(uint32_t);
|
||||||
|
size_t len = accessor.count * attribute.components;
|
||||||
|
attribute.int32s.assign( &buffer[0], &buffer[len] );
|
||||||
|
} break;
|
||||||
|
case TINYGLTF_COMPONENT_TYPE_FLOAT: {
|
||||||
|
auto* buffer = reinterpret_cast<const float*>(&(model.buffers[view.buffer].data[accessor.byteOffset + view.byteOffset]));
|
||||||
|
attribute.components = accessor.ByteStride(view) / sizeof(float);
|
||||||
|
size_t len = accessor.count * attribute.components;
|
||||||
|
attribute.floats.assign( &buffer[0], &buffer[len] );
|
||||||
|
} break;
|
||||||
|
default: UF_MSG_ERROR("Unsupported component type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( size_t i = 0; i < vertices.size(); ++i ) {
|
for ( size_t i = 0; i < vertices.size(); ++i ) {
|
||||||
#define ITERATE_ATTRIBUTE( name, member )\
|
#define ITERATE_ATTRIBUTE( name, member )\
|
||||||
if ( !attributes[name].ints.empty() ) { \
|
if ( !attributes[name].int8s.empty() ) { \
|
||||||
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
vertex.member[j] = attributes[name].ints[i * attributes[name].components + j];\
|
vertex.member[j] = attributes[name].int8s[i * attributes[name].components + j];\
|
||||||
|
} else if ( !attributes[name].int16s.empty() ) { \
|
||||||
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
|
vertex.member[j] = attributes[name].int16s[i * attributes[name].components + j];\
|
||||||
|
} else if ( !attributes[name].int32s.empty() ) { \
|
||||||
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
|
vertex.member[j] = attributes[name].int32s[i * attributes[name].components + j];\
|
||||||
} else if ( !attributes[name].floats.empty() ) { \
|
} else if ( !attributes[name].floats.empty() ) { \
|
||||||
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
for ( size_t j = 0; j < attributes[name].components; ++j )\
|
||||||
vertex.member[j] = attributes[name].floats[i * attributes[name].components + j];\
|
vertex.member[j] = attributes[name].floats[i * attributes[name].components + j];\
|
||||||
|
@ -72,7 +72,7 @@ void ext::PlayerBehavior::initialize( uf::Object& self ) {
|
|||||||
|
|
||||||
// Rotate Camera
|
// Rotate Camera
|
||||||
this->addHook( "window:Mouse.Moved", [&](pod::payloads::windowMouseMoved& payload ){
|
this->addHook( "window:Mouse.Moved", [&](pod::payloads::windowMouseMoved& payload ){
|
||||||
float sensitivity = 2;
|
float sensitivity = metadata.movement.look;
|
||||||
pod::Vector2 relta = { (float) sensitivity * payload.mouse.delta.x / payload.window.size.x, (float) sensitivity * payload.mouse.delta.y / payload.window.size.y };
|
pod::Vector2 relta = { (float) sensitivity * payload.mouse.delta.x / payload.window.size.x, (float) sensitivity * payload.mouse.delta.y / payload.window.size.y };
|
||||||
if ( (payload.mouse.delta.x == 0 && payload.mouse.delta.y == 0) || !metadata.system.control ) return;
|
if ( (payload.mouse.delta.x == 0 && payload.mouse.delta.y == 0) || !metadata.system.control ) return;
|
||||||
|
|
||||||
@ -129,64 +129,67 @@ void ext::PlayerBehavior::tick( uf::Object& self ) {
|
|||||||
auto& scene = uf::scene::getCurrentScene();
|
auto& scene = uf::scene::getCurrentScene();
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool forward;
|
bool forward = false;
|
||||||
bool backwards;
|
bool backwards = false;
|
||||||
bool left;
|
bool left = false;
|
||||||
bool right;
|
bool right = false;
|
||||||
|
|
||||||
bool lookLeft;
|
bool lookLeft = false;
|
||||||
bool lookRight;
|
bool lookRight = false;
|
||||||
bool running;
|
bool running = false;
|
||||||
bool walk;
|
bool walk = false;
|
||||||
bool jump;
|
bool jump = false;
|
||||||
bool crouch;
|
bool crouch = false;
|
||||||
bool paused;
|
bool paused = false;
|
||||||
bool vee;
|
bool vee = false;
|
||||||
bool use;
|
bool use = false;
|
||||||
} keys = {
|
} keys;
|
||||||
.forward = uf::inputs::kbm::states::W,
|
|
||||||
.backwards = uf::inputs::kbm::states::S,
|
|
||||||
.left = uf::inputs::kbm::states::A,
|
|
||||||
.right = uf::inputs::kbm::states::D,
|
|
||||||
.lookLeft = uf::inputs::kbm::states::Left,
|
|
||||||
.lookRight = uf::inputs::kbm::states::Right,
|
|
||||||
.running = uf::inputs::kbm::states::LShift,
|
|
||||||
.walk = uf::inputs::kbm::states::LAlt,
|
|
||||||
.jump = uf::inputs::kbm::states::Space,
|
|
||||||
.crouch = uf::inputs::kbm::states::LControl,
|
|
||||||
.paused = uf::inputs::kbm::states::Escape,
|
|
||||||
.vee = uf::inputs::kbm::states::V,
|
|
||||||
.use = uf::inputs::kbm::states::E,
|
|
||||||
};
|
|
||||||
|
|
||||||
if ( spec::controller::connected() ) {
|
if ( uf::Window::focused ) {
|
||||||
#if UF_USE_OPENVR
|
keys = {
|
||||||
if ( uf::inputs::controller::states::R_DPAD_UP ) keys.forward = true;
|
.forward = uf::inputs::kbm::states::W,
|
||||||
if ( uf::inputs::controller::states::R_DPAD_DOWN ) keys.backwards = true;
|
.backwards = uf::inputs::kbm::states::S,
|
||||||
if ( uf::inputs::controller::states::R_DPAD_LEFT ) keys.lookLeft = true; // keys.left = true;
|
.left = uf::inputs::kbm::states::A,
|
||||||
if ( uf::inputs::controller::states::R_DPAD_RIGHT ) keys.lookRight = true; // keys.right = true;
|
.right = uf::inputs::kbm::states::D,
|
||||||
if ( uf::inputs::controller::states::R_JOYSTICK ) keys.running = true;
|
.lookLeft = uf::inputs::kbm::states::Left,
|
||||||
if ( uf::inputs::controller::states::R_A ) keys.jump = true;
|
.lookRight = uf::inputs::kbm::states::Right,
|
||||||
|
.running = uf::inputs::kbm::states::LShift,
|
||||||
|
.walk = uf::inputs::kbm::states::LAlt,
|
||||||
|
.jump = uf::inputs::kbm::states::Space,
|
||||||
|
.crouch = uf::inputs::kbm::states::LControl,
|
||||||
|
.paused = uf::inputs::kbm::states::Escape,
|
||||||
|
.vee = uf::inputs::kbm::states::V,
|
||||||
|
.use = uf::inputs::kbm::states::E,
|
||||||
|
};
|
||||||
|
if ( spec::controller::connected() ) {
|
||||||
|
#if UF_USE_OPENVR
|
||||||
|
if ( uf::inputs::controller::states::R_DPAD_UP ) keys.forward = true;
|
||||||
|
if ( uf::inputs::controller::states::R_DPAD_DOWN ) keys.backwards = true;
|
||||||
|
if ( uf::inputs::controller::states::R_DPAD_LEFT ) keys.lookLeft = true; // keys.left = true;
|
||||||
|
if ( uf::inputs::controller::states::R_DPAD_RIGHT ) keys.lookRight = true; // keys.right = true;
|
||||||
|
if ( uf::inputs::controller::states::R_JOYSTICK ) keys.running = true;
|
||||||
|
if ( uf::inputs::controller::states::R_A ) keys.jump = true;
|
||||||
|
|
||||||
if ( uf::inputs::controller::states::L_DPAD_UP ) keys.forward = true;
|
if ( uf::inputs::controller::states::L_DPAD_UP ) keys.forward = true;
|
||||||
if ( uf::inputs::controller::states::L_DPAD_DOWN ) keys.backwards = true;
|
if ( uf::inputs::controller::states::L_DPAD_DOWN ) keys.backwards = true;
|
||||||
if ( uf::inputs::controller::states::L_DPAD_LEFT ) keys.lookLeft = true;
|
if ( uf::inputs::controller::states::L_DPAD_LEFT ) keys.lookLeft = true;
|
||||||
if ( uf::inputs::controller::states::L_DPAD_RIGHT ) keys.lookRight = true;
|
if ( uf::inputs::controller::states::L_DPAD_RIGHT ) keys.lookRight = true;
|
||||||
if ( uf::inputs::controller::states::L_JOYSTICK ) keys.crouch = true, keys.walk = true;
|
if ( uf::inputs::controller::states::L_JOYSTICK ) keys.crouch = true, keys.walk = true;
|
||||||
if ( uf::inputs::controller::states::L_A ) keys.paused = true;
|
if ( uf::inputs::controller::states::L_A ) keys.paused = true;
|
||||||
#else
|
#else
|
||||||
if ( uf::inputs::controller::states::DPAD_UP ) keys.forward = true;
|
if ( uf::inputs::controller::states::DPAD_UP ) keys.forward = true;
|
||||||
if ( uf::inputs::controller::states::DPAD_DOWN ) keys.backwards = true;
|
if ( uf::inputs::controller::states::DPAD_DOWN ) keys.backwards = true;
|
||||||
if ( uf::inputs::controller::states::DPAD_LEFT ) keys.lookLeft = true;
|
if ( uf::inputs::controller::states::DPAD_LEFT ) keys.lookLeft = true;
|
||||||
if ( uf::inputs::controller::states::DPAD_RIGHT ) keys.lookRight = true;
|
if ( uf::inputs::controller::states::DPAD_RIGHT ) keys.lookRight = true;
|
||||||
if ( uf::inputs::controller::states::A ) keys.jump = true;
|
if ( uf::inputs::controller::states::A ) keys.jump = true;
|
||||||
if ( uf::inputs::controller::states::B ) keys.running = true;
|
if ( uf::inputs::controller::states::B ) keys.running = true;
|
||||||
if ( uf::inputs::controller::states::X ) keys.crouch = true, keys.walk = true;
|
if ( uf::inputs::controller::states::X ) keys.crouch = true, keys.walk = true;
|
||||||
if ( uf::inputs::controller::states::Y ) keys.vee = true;
|
if ( uf::inputs::controller::states::Y ) keys.vee = true;
|
||||||
if ( uf::inputs::controller::states::L_TRIGGER ) keys.left = true;
|
if ( uf::inputs::controller::states::L_TRIGGER ) keys.left = true;
|
||||||
if ( uf::inputs::controller::states::R_TRIGGER ) keys.right = true;
|
if ( uf::inputs::controller::states::R_TRIGGER ) keys.right = true;
|
||||||
if ( uf::inputs::controller::states::START ) keys.paused = true;
|
if ( uf::inputs::controller::states::START ) keys.paused = true;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -500,6 +503,7 @@ void ext::PlayerBehavior::Metadata::serialize( uf::Object& self, uf::Serializer&
|
|||||||
serializerSystemPhysicsMovement["air"] = /*this->*/movement.air;
|
serializerSystemPhysicsMovement["air"] = /*this->*/movement.air;
|
||||||
serializerSystemPhysicsMovement["jump"] = uf::vector::encode(/*this->*/movement.jump);
|
serializerSystemPhysicsMovement["jump"] = uf::vector::encode(/*this->*/movement.jump);
|
||||||
serializerSystemPhysicsMovement["crouch"] = /*this->*/movement.crouch;
|
serializerSystemPhysicsMovement["crouch"] = /*this->*/movement.crouch;
|
||||||
|
serializerSystemPhysicsMovement["look"] = /*this->*/movement.look;
|
||||||
serializerAudioFootstep["list"] = /*this->*/audio.footstep.list;
|
serializerAudioFootstep["list"] = /*this->*/audio.footstep.list;
|
||||||
serializerAudioFootstep["volume"] = /*this->*/audio.footstep.volume;
|
serializerAudioFootstep["volume"] = /*this->*/audio.footstep.volume;
|
||||||
serializerCamera["invert"] = uf::vector::encode(/*this->*/camera.invert);
|
serializerCamera["invert"] = uf::vector::encode(/*this->*/camera.invert);
|
||||||
@ -527,6 +531,7 @@ void ext::PlayerBehavior::Metadata::deserialize( uf::Object& self, uf::Serialize
|
|||||||
/*this->*/movement.air = serializerSystemPhysicsMovement["air"].as<float>();
|
/*this->*/movement.air = serializerSystemPhysicsMovement["air"].as<float>();
|
||||||
/*this->*/movement.jump = uf::vector::decode(serializerSystemPhysicsMovement["jump"], pod::Vector3f{});
|
/*this->*/movement.jump = uf::vector::decode(serializerSystemPhysicsMovement["jump"], pod::Vector3f{});
|
||||||
/*this->*/movement.crouch = serializerSystemPhysicsMovement["crouch"].as<float>();
|
/*this->*/movement.crouch = serializerSystemPhysicsMovement["crouch"].as<float>();
|
||||||
|
/*this->*/movement.look = serializerSystemPhysicsMovement["look"].as<float>(1.0f);
|
||||||
ext::json::forEach( serializerAudioFootstep["list"], [&]( const ext::json::Value& value ){
|
ext::json::forEach( serializerAudioFootstep["list"], [&]( const ext::json::Value& value ){
|
||||||
/*this->*/audio.footstep.list.emplace_back(value);
|
/*this->*/audio.footstep.list.emplace_back(value);
|
||||||
});
|
});
|
||||||
|
@ -26,6 +26,7 @@ namespace ext {
|
|||||||
float walk = 1.0f;
|
float walk = 1.0f;
|
||||||
float friction = 0.8f;
|
float friction = 0.8f;
|
||||||
float air = 1.0f;
|
float air = 1.0f;
|
||||||
|
float look = 1.0f;
|
||||||
pod::Vector3f jump = {0,8,0};
|
pod::Vector3f jump = {0,8,0};
|
||||||
} movement;
|
} movement;
|
||||||
struct {
|
struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user