mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-10-19 22:27:36 -04:00
Create chell 3d model
This commit is contained in:
parent
2fcf57366d
commit
1c703b2e70
1
Makefile
1
Makefile
|
@ -161,6 +161,7 @@ build/src/scene/elevator.o: build/assets/models/props/round_elevator_collision.h
|
|||
#
|
||||
|
||||
MODEL_LIST = assets/models/cube/cube.blend \
|
||||
assets/models/player/chell.blend \
|
||||
assets/models/portal_gun/v_portalgun.blend \
|
||||
assets/models/portal_gun/w_portalgun.blend \
|
||||
assets/models/props/button.blend \
|
||||
|
|
135
assets/materials/chell.smk.yaml
Normal file
135
assets/materials/chell.smk.yaml
Normal file
|
@ -0,0 +1,135 @@
|
|||
materials:
|
||||
chell_face:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_face.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode: G_CC_MODULATEI
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_head:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_head.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode: G_CC_MODULATEI
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_pants:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_pants.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode: G_CC_MODULATEI
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_shirt:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_shirt.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode: G_CC_MODULATEI
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_neck:
|
||||
gDPSetCombineMode:
|
||||
color: [PRIMITIVE, "0", SHADE, "0"]
|
||||
alpha: ["0", "0", "0", PRIMITIVE]
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gDPSetPrimColor:
|
||||
r: 184
|
||||
g: 127
|
||||
b: 101
|
||||
a: 255
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_arm:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_shirt.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode:
|
||||
color: [PRIMITIVE, "0", SHADE, "0"]
|
||||
alpha: ["0", "0", "0", PRIMITIVE]
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gDPSetPrimColor:
|
||||
r: 184
|
||||
g: 127
|
||||
b: 101
|
||||
a: 255
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_leg:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_pants.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode:
|
||||
color: [PRIMITIVE, "0", SHADE, "0"]
|
||||
alpha: ["0", "0", "0", PRIMITIVE]
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gDPSetPrimColor:
|
||||
r: 184
|
||||
g: 127
|
||||
b: 101
|
||||
a: 255
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_boots_white:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_pants.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode:
|
||||
color: [PRIMITIVE, "0", SHADE, "0"]
|
||||
alpha: ["0", "0", "0", PRIMITIVE]
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gDPSetPrimColor:
|
||||
r: 220
|
||||
g: 220
|
||||
b: 220
|
||||
a: 255
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
||||
|
||||
chell_boots_black:
|
||||
gDPSetTile:
|
||||
filename: ./models/player/chell_pants.png
|
||||
siz: G_IM_SIZ_16b
|
||||
|
||||
gDPSetCombineMode:
|
||||
color: [PRIMITIVE, "0", SHADE, "0"]
|
||||
alpha: ["0", "0", "0", PRIMITIVE]
|
||||
gDPSetCycleType: G_CYC_1CYCLE
|
||||
|
||||
gDPSetPrimColor:
|
||||
r: 20
|
||||
g: 20
|
||||
b: 20
|
||||
a: 20
|
||||
|
||||
gSPGeometryMode:
|
||||
set: [G_LIGHTING, G_SHADE]
|
BIN
assets/materials/models/player/chell_face.png
Executable file
BIN
assets/materials/models/player/chell_face.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
assets/materials/models/player/chell_head.png
Executable file
BIN
assets/materials/models/player/chell_head.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/materials/models/player/chell_pants.png
Executable file
BIN
assets/materials/models/player/chell_pants.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/materials/models/player/chell_shirt.png
Executable file
BIN
assets/materials/models/player/chell_shirt.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/models/player/chell.blend
Normal file
BIN
assets/models/player/chell.blend
Normal file
Binary file not shown.
1
assets/models/player/chell.flags
Normal file
1
assets/models/player/chell.flags
Normal file
|
@ -0,0 +1 @@
|
|||
-m assets/materials/static.skm.yaml -m assets/materials/chell.skm.yaml --default-material default
|
|
@ -8,6 +8,19 @@
|
|||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
EstimatedTime::EstimatedTime(): materialSwitching(0.0), matrixSwitching(0.0) {
|
||||
|
||||
}
|
||||
|
||||
EstimatedTime::EstimatedTime(double total, double materialSwitching, double matrixSwitching):
|
||||
materialSwitching(materialSwitching), matrixSwitching(matrixSwitching) {
|
||||
|
||||
}
|
||||
|
||||
double EstimatedTime::GetTotal() const {
|
||||
return matrixSwitching + materialSwitching;
|
||||
}
|
||||
|
||||
struct RenderChunkPath {
|
||||
RenderChunkPath(int size);
|
||||
|
||||
|
@ -64,6 +77,8 @@ struct RenderChunkDistanceGraph {
|
|||
RenderChunkDistanceGraph(int numberOfEdges);
|
||||
|
||||
std::vector<double> edgeDistance;
|
||||
std::vector<double> materialDistance;
|
||||
std::vector<double> matrixDistance;
|
||||
std::vector<double> minDistanceTo;
|
||||
std::vector<double> maxDistanceTo;
|
||||
double bestWorstCase;
|
||||
|
@ -72,7 +87,9 @@ struct RenderChunkDistanceGraph {
|
|||
std::priority_queue<std::shared_ptr<RenderChunkPath>, std::vector<std::shared_ptr<RenderChunkPath>>, RenderChunkPathCompare> currentChunks;
|
||||
|
||||
double GetDistance(int from, int to) const;
|
||||
void SetDistance(int from, int to, double value);
|
||||
double GetMaterialDistance(int from, int to) const;
|
||||
double GetMatrixDistance(int from, int to) const;
|
||||
void SetDistance(int from, int to, struct EstimatedTime estimatedTime);
|
||||
|
||||
std::shared_ptr<RenderChunkPath> currentBest;
|
||||
};
|
||||
|
@ -82,6 +99,8 @@ RenderChunkDistanceGraph::RenderChunkDistanceGraph(int numberOfEdges) :
|
|||
numberOfEdges(numberOfEdges),
|
||||
currentBest(nullptr) {
|
||||
edgeDistance.resize(numberOfEdges * numberOfEdges);
|
||||
materialDistance.resize(numberOfEdges * numberOfEdges);
|
||||
matrixDistance.resize(numberOfEdges * numberOfEdges);
|
||||
maxDistanceTo.resize(numberOfEdges);
|
||||
minDistanceTo.resize(numberOfEdges);
|
||||
}
|
||||
|
@ -91,8 +110,18 @@ double RenderChunkDistanceGraph::GetDistance(int from, int to) const {
|
|||
return edgeDistance[from * numberOfEdges + to];
|
||||
}
|
||||
|
||||
void RenderChunkDistanceGraph::SetDistance(int from, int to, double value) {
|
||||
edgeDistance[from * numberOfEdges + to] = value;
|
||||
double RenderChunkDistanceGraph::GetMaterialDistance(int from, int to) const{
|
||||
return materialDistance[from * numberOfEdges + to];
|
||||
}
|
||||
|
||||
double RenderChunkDistanceGraph::GetMatrixDistance(int from, int to) const {
|
||||
return matrixDistance[from * numberOfEdges + to];
|
||||
}
|
||||
|
||||
void RenderChunkDistanceGraph::SetDistance(int from, int to, struct EstimatedTime estimatedTime) {
|
||||
edgeDistance[from * numberOfEdges + to] = estimatedTime.GetTotal();
|
||||
materialDistance[from * numberOfEdges + to] = estimatedTime.materialSwitching;
|
||||
matrixDistance[from * numberOfEdges + to] = estimatedTime.matrixSwitching;
|
||||
}
|
||||
|
||||
void orderRenderGreedy(struct RenderChunkDistanceGraph& graph, struct RenderChunkPath& path);
|
||||
|
@ -179,6 +208,8 @@ void orderRenderBnB(struct RenderChunkDistanceGraph& graph, int maxIterations) {
|
|||
orderRenderGreedy(graph, *graph.currentBest);
|
||||
graph.bestWorstCase = graph.currentBest->worstCase;
|
||||
|
||||
double greedyLength = graph.currentBest->currentLength;
|
||||
|
||||
orderRenderPopulateNext(graph, first);
|
||||
|
||||
int iteration = 0;
|
||||
|
@ -195,6 +226,12 @@ void orderRenderBnB(struct RenderChunkDistanceGraph& graph, int maxIterations) {
|
|||
|
||||
iteration += 1;
|
||||
}
|
||||
|
||||
if (graph.currentBest->currentLength == greedyLength) {
|
||||
std::cout << "Branch and bound could not find a better solution" << std::endl;
|
||||
} else {
|
||||
std::cout << "Branch and bound found a solution better by " << (graph.currentBest->currentLength / greedyLength) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void orderRenderGreedy(struct RenderChunkDistanceGraph& graph, struct RenderChunkPath& path) {
|
||||
|
@ -242,11 +279,11 @@ void orderRenderGreedy(struct RenderChunkDistanceGraph& graph, struct RenderChun
|
|||
path.worstCase = path.currentLength;
|
||||
}
|
||||
|
||||
double orderRenderDistance(const RenderChunk& from, const RenderChunk& to) {
|
||||
double result = 0.0;
|
||||
struct EstimatedTime orderRenderDistance(const RenderChunk& from, const RenderChunk& to) {
|
||||
struct EstimatedTime result;
|
||||
|
||||
if (from.mMaterial && to.mMaterial) {
|
||||
result += materialTransitionTime(from.mMaterial->mState, to.mMaterial->mState);
|
||||
result.materialSwitching += materialTransitionTime(from.mMaterial->mState, to.mMaterial->mState);
|
||||
};
|
||||
|
||||
Bone* ancestor = Bone::FindCommonAncestor(from.mBonePair.second, to.mBonePair.first);
|
||||
|
@ -268,10 +305,10 @@ double orderRenderDistance(const RenderChunk& from, const RenderChunk& to) {
|
|||
}
|
||||
|
||||
if (fromBoneHeight) {
|
||||
result += TIMING_DP_MATRIX_POP;
|
||||
result.matrixSwitching += TIMING_DP_MATRIX_POP;
|
||||
}
|
||||
|
||||
result += toBoneHeight * TIMING_DP_MATRIX_MUL;
|
||||
result.matrixSwitching += toBoneHeight * TIMING_DP_MATRIX_MUL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -330,9 +367,11 @@ void orderRenderChunks(std::vector<RenderChunk>& chunks, const DisplayListSettin
|
|||
continue;;
|
||||
}
|
||||
|
||||
double distance = orderRenderDistance(chunks[from], chunks[to]);
|
||||
EstimatedTime time = orderRenderDistance(chunks[from], chunks[to]);
|
||||
|
||||
graph.SetDistance(from, to, distance);
|
||||
graph.SetDistance(from, to, time);
|
||||
|
||||
double distance = time.GetTotal();
|
||||
|
||||
if (from == 0 || distance < graph.minDistanceTo[to]) {
|
||||
graph.minDistanceTo[to] = distance;
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
#include "CFileDefinition.h"
|
||||
#include "DisplayListSettings.h"
|
||||
|
||||
struct EstimatedTime {
|
||||
EstimatedTime();
|
||||
EstimatedTime(double total, double materialSwitching, double matrixSwitching);
|
||||
|
||||
double GetTotal() const;
|
||||
|
||||
double materialSwitching;
|
||||
double matrixSwitching;
|
||||
};
|
||||
|
||||
void orderRenderChunks(std::vector<RenderChunk>& chunks, const DisplayListSettings& settings);
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue