Working with lights and shadows
This commit is contained in:
parent
e3542b59f7
commit
ed8d6f2e92
@ -406,6 +406,7 @@
|
|||||||
"name": "Room_Cover_Bath_W_N_2_001",
|
"name": "Room_Cover_Bath_W_N_2_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_North_West_1_Bath_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_North_West_1_Bath_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -419,6 +420,7 @@
|
|||||||
"name": "Room_Cover_LivingRoom_W_N_2_001",
|
"name": "Room_Cover_LivingRoom_W_N_2_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_North_West_1_RoomB_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_North_West_1_RoomB_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -432,6 +434,7 @@
|
|||||||
"name": "Room_Cover_LivingRoom_W_S_2_001",
|
"name": "Room_Cover_LivingRoom_W_S_2_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_South_West_1_RoomB_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_South_West_1_RoomB_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -445,6 +448,7 @@
|
|||||||
"name": "Room_Cover_Main_Hall_And_Corridors_002",
|
"name": "Room_Cover_Main_Hall_And_Corridors_002",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_Main_Hall_Corridor_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_Main_Hall_Corridor_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -458,6 +462,7 @@
|
|||||||
"name": "Room_Cover_Others_001",
|
"name": "Room_Cover_Others_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_All_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_All_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -471,6 +476,7 @@
|
|||||||
"name": "Room_Cover_Utility_W_N_3_001",
|
"name": "Room_Cover_Utility_W_N_3_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_North_West_2_Utility_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_North_West_2_Utility_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -484,6 +490,7 @@
|
|||||||
"name": "Room_Cover_Utility_W_S_3_001",
|
"name": "Room_Cover_Utility_W_S_3_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/dorm2/Room_Cover_South_West_2_Utility_001.txt",
|
"meshPath": "resources/w/dorm2/Room_Cover_South_West_2_Utility_001.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
|
|||||||
@ -307,6 +307,7 @@
|
|||||||
"name": "Room_Cover_Corridor_001",
|
"name": "Room_Cover_Corridor_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_Corridor_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_Corridor_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -323,6 +324,7 @@
|
|||||||
"name": "Room_Cover_Main_Hall_001",
|
"name": "Room_Cover_Main_Hall_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_Main_Hall_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_Main_Hall_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -339,6 +341,7 @@
|
|||||||
"name": "Room_Cover_North_1_001",
|
"name": "Room_Cover_North_1_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_North_1_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_North_1_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -355,6 +358,7 @@
|
|||||||
"name": "Room_Cover_South_1_001",
|
"name": "Room_Cover_South_1_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_South_1_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_South_1_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -371,6 +375,7 @@
|
|||||||
"name": "Room_Cover_North_2_001",
|
"name": "Room_Cover_North_2_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_North_2_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_North_2_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -387,6 +392,7 @@
|
|||||||
"name": "Room_Cover_South_2_001",
|
"name": "Room_Cover_South_2_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_South_2_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_South_2_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -403,6 +409,7 @@
|
|||||||
"name": "Room_Cover_North_3_001",
|
"name": "Room_Cover_North_3_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_North_3_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_North_3_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
@ -419,6 +426,7 @@
|
|||||||
"name": "Room_Cover_South_3_001",
|
"name": "Room_Cover_South_3_001",
|
||||||
"texturePath": "resources/black.png",
|
"texturePath": "resources/black.png",
|
||||||
"meshPath": "resources/w/interior/Room_Cover_South_3_002.txt",
|
"meshPath": "resources/w/interior/Room_Cover_South_3_002.txt",
|
||||||
|
"castShadowNight" : false,
|
||||||
"rotationX": 0.0,
|
"rotationX": 0.0,
|
||||||
"rotationY": 0.0,
|
"rotationY": 0.0,
|
||||||
"rotationZ": 0.0,
|
"rotationZ": 0.0,
|
||||||
|
|||||||
@ -53,8 +53,8 @@ void main()
|
|||||||
if (color.a < 0.1)
|
if (color.a < 0.1)
|
||||||
discard;
|
discard;
|
||||||
|
|
||||||
float ambient = 0.4;
|
float ambient = 0.75;
|
||||||
float diffuseStrength = 0.6;
|
float diffuseStrength = 0.25;
|
||||||
|
|
||||||
// Compute diffuse term; if normals are missing (zero-length) treat as fully lit
|
// Compute diffuse term; if normals are missing (zero-length) treat as fully lit
|
||||||
float diffuse = 1.0;
|
float diffuse = 1.0;
|
||||||
|
|||||||
@ -53,8 +53,8 @@ void main()
|
|||||||
if (color.a < 0.1)
|
if (color.a < 0.1)
|
||||||
discard;
|
discard;
|
||||||
|
|
||||||
float ambient = 0.4;
|
float ambient = 0.75;
|
||||||
float diffuseStrength = 0.6;
|
float diffuseStrength = 0.25;
|
||||||
|
|
||||||
float diffuse = 1.0;
|
float diffuse = 1.0;
|
||||||
vec3 n = fragNormal;
|
vec3 n = fragNormal;
|
||||||
|
|||||||
@ -713,7 +713,7 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& intObj : interactiveObjects) {
|
for (auto& intObj : interactiveObjects) {
|
||||||
if (intObj.isActive && intObj.loadedObject.texture) {
|
if (intObj.castShadow && intObj.loadedObject.texture) {
|
||||||
renderer.PushMatrix();
|
renderer.PushMatrix();
|
||||||
renderer.TranslateMatrix(intObj.position);
|
renderer.TranslateMatrix(intObj.position);
|
||||||
renderer.DrawVertexRenderStruct(intObj.loadedObject.mesh);
|
renderer.DrawVertexRenderStruct(intObj.loadedObject.mesh);
|
||||||
@ -957,7 +957,7 @@ namespace ZL
|
|||||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||||
}
|
}
|
||||||
for (auto& intObj : interactiveObjects) {
|
for (auto& intObj : interactiveObjects) {
|
||||||
if (intObj.isActive && intObj.loadedObject.texture) {
|
if (intObj.castShadowNight && intObj.loadedObject.texture) {
|
||||||
renderer.PushMatrix();
|
renderer.PushMatrix();
|
||||||
renderer.TranslateMatrix(intObj.position);
|
renderer.TranslateMatrix(intObj.position);
|
||||||
renderer.DrawVertexRenderStruct(intObj.loadedObject.mesh);
|
renderer.DrawVertexRenderStruct(intObj.loadedObject.mesh);
|
||||||
|
|||||||
@ -94,6 +94,9 @@ namespace ZL {
|
|||||||
data.base = parseGameObjectData(item);
|
data.base = parseGameObjectData(item);
|
||||||
data.interactionRadius = item.value("interactionRadius", 2.0f);
|
data.interactionRadius = item.value("interactionRadius", 2.0f);
|
||||||
data.approachRadius = item.value("approachRadius", data.interactionRadius);
|
data.approachRadius = item.value("approachRadius", data.interactionRadius);
|
||||||
|
data.castShadow = item.value("castShadow", true);
|
||||||
|
data.castShadowNight = item.value("castShadowNight", true);
|
||||||
|
data.isActive = item.value("isActive", true);
|
||||||
data.activateFunctionName = item.value("activateFunction", "");
|
data.activateFunctionName = item.value("activateFunction", "");
|
||||||
data.pivotX = item.value("pivotX", 0.0f);
|
data.pivotX = item.value("pivotX", 0.0f);
|
||||||
data.pivotY = item.value("pivotY", 0.0f);
|
data.pivotY = item.value("pivotY", 0.0f);
|
||||||
@ -196,6 +199,9 @@ namespace ZL {
|
|||||||
intObj.loadedObject = buildLoadedObject(data.base, renderer, zipPath);
|
intObj.loadedObject = buildLoadedObject(data.base, renderer, zipPath);
|
||||||
intObj.interactionRadius = data.interactionRadius;
|
intObj.interactionRadius = data.interactionRadius;
|
||||||
intObj.approachRadius = data.approachRadius;
|
intObj.approachRadius = data.approachRadius;
|
||||||
|
intObj.castShadow = data.castShadow;
|
||||||
|
intObj.castShadowNight = data.castShadowNight;
|
||||||
|
intObj.isActive = data.isActive;
|
||||||
intObj.activateFunctionName = data.activateFunctionName;
|
intObj.activateFunctionName = data.activateFunctionName;
|
||||||
intObj.pivot = Eigen::Vector3f(data.pivotX, data.pivotY, data.pivotZ);
|
intObj.pivot = Eigen::Vector3f(data.pivotX, data.pivotY, data.pivotZ);
|
||||||
intObj.boundsMin = Eigen::Vector3f(data.boundsMinX, data.boundsMinY, data.boundsMinZ);
|
intObj.boundsMin = Eigen::Vector3f(data.boundsMinX, data.boundsMinY, data.boundsMinZ);
|
||||||
|
|||||||
@ -38,6 +38,9 @@ namespace ZL {
|
|||||||
float boundsMaxX = 0.0f, boundsMaxY = 0.0f, boundsMaxZ = 0.0f;
|
float boundsMaxX = 0.0f, boundsMaxY = 0.0f, boundsMaxZ = 0.0f;
|
||||||
bool hasInteractionPosition = false;
|
bool hasInteractionPosition = false;
|
||||||
float interactionPositionX = 0.0f, interactionPositionY = 0.0f, interactionPositionZ = 0.0f;
|
float interactionPositionX = 0.0f, interactionPositionY = 0.0f, interactionPositionZ = 0.0f;
|
||||||
|
bool castShadow = true;
|
||||||
|
bool castShadowNight = true;
|
||||||
|
bool isActive = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NpcData {
|
struct NpcData {
|
||||||
|
|||||||
@ -42,6 +42,8 @@ namespace ZL {
|
|||||||
bool hasInteractionPosition = false;
|
bool hasInteractionPosition = false;
|
||||||
bool isActive = true;
|
bool isActive = true;
|
||||||
bool isAnimating = false; // true while a timed animation is running
|
bool isAnimating = false; // true while a timed animation is running
|
||||||
|
bool castShadow = true; // included in day shadow depth pass regardless of isActive
|
||||||
|
bool castShadowNight = true; // included in night shadow depth pass regardless of isActive
|
||||||
std::string activateFunctionName;
|
std::string activateFunctionName;
|
||||||
|
|
||||||
struct AnimTask {
|
struct AnimTask {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user