small bugfixes

This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent c4cfe607f7
commit e07f30e3f7
5 changed files with 22 additions and 44 deletions
+1 -7
View File
@@ -52,6 +52,7 @@ namespace vb01{
Root *root=Root::getSingleton();
Node *rootNode=root->getRootNode();
std::vector<Node*> descendants;
rootNode->getDescendants(rootNode, descendants);
std::vector<Material*> materials;
Camera *cam=root->getCamera();
int thisId=-1;
@@ -143,16 +144,9 @@ namespace vb01{
shader->setVec3(color,"light["+to_string(thisId)+"].color");
shader->setFloat(nearPlane,"light["+to_string(thisId)+"].near");
shader->setFloat(farPlane,"light["+to_string(thisId)+"].far");
shader->setInt(0,"diffuseMap");
shader->setInt(1,"normalMap");
shader->setInt(2,"specularMap");
shader->setInt(3,"parallaxMap");
shader->setInt(4,"environmentMap");
shader->setInt(5,"light["+to_string(thisId)+"].depthMapCube");
shader->setInt(6,"light["+to_string(thisId)+"].depthMap");
depthMap->select(type==POINT?5:6);
/*
*/
switch(type){
case POINT:
-20
View File
@@ -1,23 +1,3 @@
#include"box.h"
#include"camera.h"
#include"light.h"
#include"material.h"
#include"mesh.h"
#include"model.h"
#include"node.h"
#include"particleEmitter.h"
#include"quad.h"
#include"quaternion.h"
#include"rectangle.h"
#include"root.h"
#include"shader.h"
#include"stb_image.h"
#include"text.h"
#include"texture.h"
#include"util.h"
#include"vector.h"
#include"waterPlane.h"
int main(){
return 0;
}
+6
View File
@@ -61,6 +61,12 @@ namespace vb01{
shader->setVec4(diffuseColor,"diffuseColor");
}
if(texturingEnabled){
shader->setInt(0,"diffuseMap");
shader->setInt(1,"normalMap");
shader->setInt(2,"specularMap");
shader->setInt(3,"parallaxMap");
shader->setInt(4,"environmentMap");
for(Texture *t : diffuseMapTextures)
t->update(0);
for(Texture *t : normalMapTextures)
+11 -13
View File
@@ -74,8 +74,8 @@ namespace vb01{
VbModelReader::~VbModelReader(){
}
void VbModelReader::readBones(vector<string> &meshData, Skeleton *skeleton, int boneStartLine, int numBones){
meshData.clear();
void VbModelReader::readBones(Skeleton *skeleton, int boneStartLine, int numBones){
vector<string> meshData;
readFile(path, meshData, boneStartLine, boneStartLine + numBones);
vector<string> ikRelationships;
@@ -131,12 +131,12 @@ namespace vb01{
}
}
void VbModelReader::readAnimations(vector<string> &meshData, Skeleton *skeleton, int animationStartLine, int endLine){
void VbModelReader::readAnimations(Skeleton *skeleton, int animationStartLine, int endLine){
AnimationController *controller = skeleton->getAnimationController();
string animName = "";
Bone *animBone = nullptr;
Animation::KeyframeGroup::KeyframeChannel::Type type;
meshData.clear();
vector<string> meshData;
readFile(path, meshData, animationStartLine, endLine + 1);
for(string l : meshData){
@@ -225,14 +225,13 @@ namespace vb01{
Skeleton *skeleton = new Skeleton(name);
skeletons.push_back(skeleton);
readBones(meshData, skeleton, boneStartLine, numBones);
readBones(skeleton, boneStartLine, numBones);
readAnimations(meshData, skeleton, animationStartLine, endLine);
readAnimations(skeleton, animationStartLine, endLine);
}
void VbModelReader::readVertices(
vector<string> &meshData,
vector<Vector3> &vertPos,
vector<Vector3> &vertNorm,
vector<float> &vertWeights,
@@ -240,7 +239,7 @@ namespace vb01{
int numVertices,
int numBones
){
meshData.clear();
vector<string> meshData;
readFile(path, meshData, vertexStartLine, vertexStartLine + numVertices);
for(string line : meshData){
int numData = 6 + numBones;
@@ -257,7 +256,6 @@ namespace vb01{
}
void VbModelReader::readFaces(
vector<string> &meshData,
vector<Vector3> &vertPos,
vector<Vector3> &vertNorm,
vector<float> &vertWeights,
@@ -269,7 +267,7 @@ namespace vb01{
u32 *indices
){
int i = 0;
meshData.clear();
vector<string> meshData;
readFile(path, meshData, faceStartLine, faceStartLine + numFaces * numVertsPerFace);
for(string line : meshData){
int numData = 9;
@@ -352,11 +350,11 @@ namespace vb01{
groups[i] = meshData[i];
}
readVertices(meshData, vertPos, vertNorm, vertWeights, vertexGroupStartLine, numVertices, numBones);
readFaces(meshData, vertPos, vertNorm, vertWeights, faceStartLine, numFaces, numVertsPerFace, numBones, vertices, indices);
readVertices(vertPos, vertNorm, vertWeights, vertexStartLine, numVertices, numBones);
readFaces(vertPos, vertNorm, vertWeights, faceStartLine, numFaces, numVertsPerFace, numBones, vertices, indices);
meshData.clear();
readFile(path, meshData, shapeKeyStartLine, shapeKeyStartLine + numShapes);
for(int i = 0; i < numShapes; i++){
}
+4 -4
View File
@@ -17,11 +17,11 @@ namespace vb01{
VbModelReader(Model*, std::string);
~VbModelReader();
private:
void readBones(std::vector<std::string>&, Skeleton*, int, int);
void readAnimations(std::vector<std::string>&, Skeleton*, int, int);
void readBones(Skeleton*, int, int);
void readAnimations(Skeleton*, int, int);
void readSkeletons(int, int);
void readVertices(std::vector<std::string>&, std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, int, int, int);
void readFaces(std::vector<std::string>&, std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, int, int, int, int, Mesh::Vertex*, u32*);
void readVertices(std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, int, int, int);
void readFaces(std::vector<Vector3>&, std::vector<Vector3>&, std::vector<float>&, int, int, int, int, Mesh::Vertex*, u32*);
void readMeshes(int, int);
void readLights(int, int);