From d1f2f9b152c6f007d1fe015db4e0915662486339 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sat, 14 Sep 2019 20:48:39 +0300 Subject: [PATCH] mostly implemented particle emitter --- CMakeLists.txt | 5 +- light.cpp | 10 ++-- main.cpp | 24 ++++++--- material.cpp | 5 +- material.h | 2 +- mesh.cpp | 4 +- node.cpp | 8 +++ node.h | 3 ++ particle.frag | 16 ++++++ particle.vert | 20 +++++++ particleEmitter.cpp | 128 ++++++++++++++++++++++++++++++++++++++++++++ particleEmitter.h | 45 ++++++++++++++++ root.cpp | 14 +++-- shader.cpp | 12 ++++- shader.h | 5 +- tags | 97 +++++++++++++++++++++++++++++++-- util.cpp | 5 ++ util.h | 23 ++++++++ vector.cpp | 7 +++ vector.h | 25 ++++++++- waterPlane.cpp | 5 ++ waterPlane.h | 12 +++++ 22 files changed, 444 insertions(+), 31 deletions(-) create mode 100644 particle.frag create mode 100644 particle.vert create mode 100644 particleEmitter.cpp create mode 100644 particleEmitter.h create mode 100644 util.cpp create mode 100644 util.h create mode 100644 waterPlane.cpp create mode 100644 waterPlane.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b826eef..b9ce738 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,11 @@ include_directories(/usr/include/assimp) link_directories(/usr/lib/) set(CMAKE_BUILD_TYPE Debug) +set(utils util.cpp) set(math quaternion.cpp vector.cpp) -set(render camera.cpp light.cpp material.cpp mesh.cpp model.cpp node.cpp quad.cpp box.cpp root.cpp shader.cpp texture.cpp) +set(render waterPlane.cpp particleEmitter.cpp camera.cpp light.cpp material.cpp mesh.cpp model.cpp node.cpp quad.cpp box.cpp root.cpp shader.cpp texture.cpp) -add_executable(vb01 main.cpp ${render} ${math}) +add_executable(vb01 main.cpp ${render} ${math} ${utils}) target_link_libraries(vb01 glfw) target_link_libraries(vb01 glad) target_link_libraries(vb01 assimp) diff --git a/light.cpp b/light.cpp index 55c8c33..90bf034 100644 --- a/light.cpp +++ b/light.cpp @@ -42,20 +42,20 @@ namespace vb01{ Shader *shader=m->getShader(); shader->use(); shader->setInt((int)type,"light["+to_string(thisId)+"].type"); - shader->setVec3(vec3(color.x,color.y,color.z),"light["+to_string(thisId)+"].color"); + shader->setVec3(color,"light["+to_string(thisId)+"].color"); switch(type){ case POINT: - shader->setVec3(vec3(pos.x,pos.y,pos.z),"light["+to_string(thisId)+"].pos"); + shader->setVec3(pos,"light["+to_string(thisId)+"].pos"); shader->setFloat(attenuationValues.x,"light["+to_string(thisId)+"].a"); shader->setFloat(attenuationValues.y,"light["+to_string(thisId)+"].b"); shader->setFloat(attenuationValues.z,"light["+to_string(thisId)+"].c"); break; case DIRECTIONAL: - shader->setVec3(vec3(direction.x,direction.y,direction.z),"light["+to_string(thisId)+"].direction"); + shader->setVec3(direction,"light["+to_string(thisId)+"].direction"); break; case SPOT: - shader->setVec3(vec3(pos.x,pos.y,pos.z),"light["+to_string(thisId)+"].pos"); - shader->setVec3(vec3(direction.x,direction.y,direction.z),"light["+to_string(thisId)+"].direction"); + shader->setVec3(pos,"light["+to_string(thisId)+"].pos"); + shader->setVec3(direction,"light["+to_string(thisId)+"].direction"); shader->setFloat(attenuationValues.x,"light["+to_string(thisId)+"].a"); shader->setFloat(attenuationValues.y,"light["+to_string(thisId)+"].b"); shader->setFloat(attenuationValues.z,"light["+to_string(thisId)+"].c"); diff --git a/main.cpp b/main.cpp index 7dfc92f..d9e9957 100644 --- a/main.cpp +++ b/main.cpp @@ -9,6 +9,7 @@ #include"model.h" #include"light.h" #include +#include"particleEmitter.h" using namespace vb01; using namespace std; @@ -18,7 +19,7 @@ int main(){ root->start(800,600); Vector3 v1[]={Vector3(.2,.2,.2),Vector3(1,1,1)}; - Vector3 v2[]={Vector3(0,0,0),Vector3(.0,0,0)}; + Vector3 v2[]={Vector3(2,0,0),Vector3(-1,0,0)}; string t[]={ "/home/dominykas/c++/FSim/left.jpg", @@ -30,18 +31,27 @@ int main(){ }; root->createSkybox(t); - Box *b=new Box(Vector3(1,1,1)); - Node *n=new Node(v2[0]); + for(int i=0;i<2;i++){ + Box *box=new Box(Vector3(1,1,1)); + Node *node=new Node(v2[i]); Material *mat=new Material(); mat->addDiffuseMap("/home/dominykas/c++/FSim/defaultTexture.jpg"); mat->setLightingEnabled(false); - b->setMaterial(mat); - n->attachMesh(b); - root->getRootNode()->attachChild(n); + box->setMaterial(mat); + node->attachMesh(box); + //root->getRootNode()->attachChild(node); + } + + ParticleEmitter *pe=new ParticleEmitter(100); + Node *node2=new Node(Vector3(0,0,0)); + Material *mat2=new Material(Material::MATERIAL_PARTICLE); + mat2->addDiffuseMap("/home/dominykas/c++/FSim/stern.jpg"); + pe->setMaterial(mat2); + node2->attachParticleEmitter(pe); + root->getRootNode()->attachChild(node2); Camera *cam=Root::getSingleton()->getCamera(); cam->setPosition(Vector3(0,0,-5)); - cam->lookAt(Vector3(1,0,1).norm(),Vector3(0,1,0)); Light *l1=new Light(); l1->setPosition(Vector3(-.5,.1,0)); l1->setColor(Vector3(0,1,0)); diff --git a/material.cpp b/material.cpp index d12fe47..ba86ae2 100644 --- a/material.cpp +++ b/material.cpp @@ -12,6 +12,9 @@ namespace vb01{ case MATERIAL_2D: shaderName="texture."; break; + case MATERIAL_PARTICLE: + shaderName="particle."; + break; case MATERIAL_SKYBOX: shaderName="skybox."; break; @@ -23,7 +26,7 @@ namespace vb01{ void Material::update(){ shader->use(); - shader->setBool(lightingEnabled,"lightingEnabled"); + if(type==MATERIAL_2D)shader->setBool(lightingEnabled,"lightingEnabled"); for(Texture *t : diffuseMapTextures) t->select(); for(Texture *t : normalMapTextures) diff --git a/material.h b/material.h index 190cb59..49ca47c 100644 --- a/material.h +++ b/material.h @@ -8,7 +8,7 @@ namespace vb01{ class Material{ public: - enum Type{MATERIAL_2D,MATERIAL_SKYBOX}; + enum Type{MATERIAL_2D,MATERIAL_PARTICLE,MATERIAL_SKYBOX}; Material(Type=MATERIAL_2D); ~Material(); diff --git a/mesh.cpp b/mesh.cpp index 72d27c7..2095230 100644 --- a/mesh.cpp +++ b/mesh.cpp @@ -53,13 +53,13 @@ namespace vb01{ Vector3 dir=cam->getDirection(),up=cam->getUp(),camPos=cam->getPosition(); mat4 model=translate(mat4(1.),vec3(pos.x,pos.y,pos.z)); - model=rotate(model,radians(0.f),vec3(0,1,0)); + model=rotate(model,radians(0.f),vec3(1,1,1)); mat4 view=lookAt(vec3(camPos.x,camPos.y,camPos.z),vec3(camPos.x+dir.x,camPos.y+dir.y,camPos.z+dir.z),vec3(up.x,up.y,up.z)); mat4 proj=perspective(radians(fov),width/height,nearPlane,farPlane); //proj=ortho(0.f,800.f,0.f,-600.f,nearPlane,farPlane); material->update(); - material->getShader()->setVec3(vec3(camPos.x,camPos.y,camPos.z),"camPos"); + material->getShader()->setVec3(camPos,"camPos"); material->getShader()->setMat4(model,"model"); material->getShader()->setMat4(view,"view"); material->getShader()->setMat4(proj,"proj"); diff --git a/node.cpp b/node.cpp index 48d33f5..4983a0b 100644 --- a/node.cpp +++ b/node.cpp @@ -1,6 +1,7 @@ #include"root.h" #include"node.h" #include"mesh.h" +#include"particleEmitter.h" #include"light.h" #include"material.h" @@ -18,6 +19,8 @@ namespace vb01{ m->update(); for(Light *l : lights) l->update(); + for(ParticleEmitter *p : emitters) + p->update(); for(Node *c : children) c->update(); } @@ -37,6 +40,11 @@ namespace vb01{ mesh->setNode(this); } + void Node::attachParticleEmitter(ParticleEmitter *emitter){ + emitters.push_back(emitter); + emitter->setNode(this); + } + void Node::addLight(Light *light){ lights.push_back(light); light->setNode(this); diff --git a/node.h b/node.h index 6370d82..5049c0b 100644 --- a/node.h +++ b/node.h @@ -9,12 +9,14 @@ namespace vb01{ class Mesh; class Model; class Light; + class ParticleEmitter; class Node{ public: Node(Vector3=Vector3::VEC_ZERO); ~Node(); void attachMesh(Mesh*); + void attachParticleEmitter(ParticleEmitter*); virtual void update(); void attachChild(Node*); void addLight(Light*); @@ -29,6 +31,7 @@ namespace vb01{ protected: Vector3 pos; std::vector meshes; + std::vector emitters; std::vector children,descendants; std::vector lights; Node *parent=nullptr; diff --git a/particle.frag b/particle.frag new file mode 100644 index 0000000..ff8de73 --- /dev/null +++ b/particle.frag @@ -0,0 +1,16 @@ +#version 330 core + +in vec2 texCoords; + +flat in int id; + +out vec4 FragColor; + +uniform sampler2D tex; +uniform vec4 color[100]; + +void main(){ + float alpha=texture(tex,texCoords).x; + vec4 c=color[id]; + FragColor=vec4(c.x,c.y,c.z,c.w*alpha); +} diff --git a/particle.vert b/particle.vert new file mode 100644 index 0000000..db8dbb0 --- /dev/null +++ b/particle.vert @@ -0,0 +1,20 @@ +#version 330 core + +layout (location=0) in vec3 aPos; +layout (location=1) in vec2 aTexCoords; + +out vec2 texCoords; + +flat out int id; + +uniform mat4 proj; +uniform mat4 view; +uniform mat4 model[100]; +uniform vec2 size[100]; + +void main(){ + id=gl_InstanceID; + vec2 s=size[gl_InstanceID]; + gl_Position=proj*view*model[gl_InstanceID]*vec4(s.x*aPos.x,s.y*aPos.y,aPos.z,1); + texCoords=aTexCoords; +} diff --git a/particleEmitter.cpp b/particleEmitter.cpp new file mode 100644 index 0000000..535ebcf --- /dev/null +++ b/particleEmitter.cpp @@ -0,0 +1,128 @@ +#include"particleEmitter.h" +#include"shader.h" +#include +#include +#include +#include +#include +#include"material.h" +#include"node.h" +#include"root.h" +#include"camera.h" + +using namespace glm; +using namespace std; + +namespace vb01{ + ParticleEmitter::ParticleEmitter(int numParticles){ + this->numParticles=numParticles; + + particles=new Particle[numParticles]; + + Vertex v1,v2,v3,v4,v5,v6; + Vector2 size=Vector2(.5,.5); + v1.pos=Vector3(size.x/2,size.y/2,0); + v1.texCoords=Vector2(1,1); + + v2.pos=Vector3(-size.x/2,size.y/2,0); + v2.texCoords=Vector2(0,1); + + v3.pos=Vector3(-size.x/2,-size.y/2,0); + v3.texCoords=Vector2(0,0); + + v4.pos=Vector3(-size.x/2,-size.y/2,0); + v4.texCoords=Vector2(0,0); + + v5.pos=Vector3(size.x/2,-size.y/2,0); + v5.texCoords=Vector2(1,0); + + v6.pos=Vector3(size.x/2,size.y/2,0); + v6.texCoords=Vector2(1,1); + + ParticleEmitter::Vertex vertices[]={v1,v2,v3,v4,v5,v6}; + unsigned int indices[]={0,1,2,3,4,5}; + + for(int i=0;igetCamera(); + float fov=cam->getFov(),width=root->getWidth(),height=root->getHeight(); + float nearPlane=cam->getNearPlane(),farPlane=cam->getFarPlane(); + Vector3 pos=node->getPosition(); + Vector3 camDir=cam->getDirection(),up=cam->getUp(),camPos=cam->getPosition(); + + mat4 view=lookAt(vec3(camPos.x,camPos.y,camPos.z),vec3(camPos.x+camDir.x,camPos.y+camDir.y,camPos.z+camDir.z),vec3(up.x,up.y,up.z)); + mat4 proj=perspective(radians(fov),width/height,nearPlane,farPlane); + + material->update(); + Shader *shader=material->getShader(); + shader->setMat4(view,"view"); + shader->setMat4(proj,"proj"); + for(int i=0;i=particles[i].timeToLive){ + particles[i].time=getTime(); + float factor=(float)(rand()%100)/100; + float spreadX=(float)(rand()%360)/180*PI,spreadY=(float)(rand()%360)/180*PI; + dir=Vector3(cos(abs(spreadX)>spread?spread:spreadX),sin(abs(spreadY)>spread?spread:spreadY),0); + particles[i].timeToLive=s64(1000*((highLife-lowLife)*factor+lowLife)); + particles[i].mat=translate(mat4(1.f),vec3(dir.x,dir.y,dir.z)); + } + dir=dir.norm()*direction.getLengthSq(); + float lifePercentage=(float)(getTime()-particles[i].time)/particles[i].timeToLive; + particles[i].color=startColor+(endColor-startColor)*lifePercentage; + particles[i].size=startSize+(endSize-startSize)*lifePercentage; + particles[i].mat=translate(particles[i].mat,vec3(dir.x,dir.y,dir.z)); + + } + for(int i=0;isetMat4(particles[i].mat,"model["+to_string(i)+"]"); + shader->setVec4(particles[i].color,"color["+to_string(i)+"]"); + shader->setVec2(particles[i].size,"size["+to_string(i)+"]"); + } + + glBindVertexArray(VAO); + glDrawElementsInstanced(GL_TRIANGLES,6,GL_UNSIGNED_INT,0,numParticles); + } +} diff --git a/particleEmitter.h b/particleEmitter.h new file mode 100644 index 0000000..2f078df --- /dev/null +++ b/particleEmitter.h @@ -0,0 +1,45 @@ +#ifndef PARTICLE_EMITTER_H +#define PARTICLE_EMITTER_H + +#include"vector.h" +#include"util.h" +#include + +namespace vb01{ + class Shader; + class Node; + class Material; + + class ParticleEmitter{ + public: + ParticleEmitter(int=1); + ~ParticleEmitter(); + void update(); + inline void setMaterial(Material *mat){this->material=mat;} + inline void setNode(Node *node){this->node=node;} + private: + struct Vertex{ + Vector3 pos; + Vector2 texCoords; + }; + struct Particle{ + glm::mat4 mat; + s64 time=0,timeToLive=0; + Vector4 color; + Vector3 dir; + Vector2 size; + }; + + unsigned int instanceVBO,VAO,VBO,EBO; + int numParticles; + Particle *particles; + Material *material=nullptr; + Node *node=nullptr; + Vector2 startSize=Vector2::VEC_IJ,endSize=Vector2::VEC_IJ; + Vector3 direction=Vector3(0,1,0); + Vector4 startColor,endColor; + float spread=0,lowLife=1,highLife=2; + }; +} + +#endif diff --git a/root.cpp b/root.cpp index b24e92c..ed68de5 100644 --- a/root.cpp +++ b/root.cpp @@ -46,6 +46,8 @@ namespace vb01{ glEnable(GL_DEPTH_TEST); glEnable(GL_STENCIL_TEST); glEnable(GL_CULL_FACE); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); } void Root::update(){ @@ -53,11 +55,13 @@ namespace vb01{ glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - glDepthMask(GL_FALSE); - glCullFace(GL_BACK); - skybox->update(); - glDepthMask(GL_TRUE); - glCullFace(GL_FRONT); + if(skybox){ + glDepthMask(GL_FALSE); + glCullFace(GL_BACK); + skybox->update(); + glDepthMask(GL_TRUE); + glCullFace(GL_FRONT); + } rootNode->update(); glfwSwapBuffers(window); diff --git a/shader.cpp b/shader.cpp index d28be51..231fd05 100644 --- a/shader.cpp +++ b/shader.cpp @@ -103,11 +103,21 @@ namespace vb01{ glUniform1f(uniformLoc,fl); } - void Shader::setVec3(vec3 vec, string var){ + void Shader::setVec4(Vector4 vec, string var){ + int uniformLoc=glGetUniformLocation(id,var.c_str()); + glUniform4f(uniformLoc,vec.x,vec.y,vec.z,vec.w); + } + + void Shader::setVec3(Vector3 vec, string var){ int uniformLoc=glGetUniformLocation(id,var.c_str()); glUniform3f(uniformLoc,vec.x,vec.y,vec.z); } + void Shader::setVec2(Vector2 vec, string var){ + int uniformLoc=glGetUniformLocation(id,var.c_str()); + glUniform2f(uniformLoc,vec.x,vec.y); + } + void Shader::setBool(bool b, string var){ int uniformLoc=glGetUniformLocation(id,var.c_str()); glUniform1i(uniformLoc,(int)b); diff --git a/shader.h b/shader.h index 08442a7..3ad3e51 100644 --- a/shader.h +++ b/shader.h @@ -3,6 +3,7 @@ #include #include +#include"vector.h" namespace vb01{ class Shader{ @@ -13,7 +14,9 @@ namespace vb01{ void setNumLights(int); void use(); void setMat4(glm::mat4,std::string); - void setVec3(glm::vec3,std::string); + void setVec4(Vector4,std::string); + void setVec3(Vector3,std::string); + void setVec2(Vector2,std::string); void setFloat(float,std::string); void setBool(bool,std::string); void setInt(int,std::string); diff --git a/tags b/tags index bc703d7..ecc8bfa 100644 --- a/tags +++ b/tags @@ -14,15 +14,17 @@ Camera camera.cpp /^ Camera::Camera(){$/;" f class:vb01::Camera Camera camera.h /^ class Camera{$/;" c namespace:vb01 DIRECTIONAL light.h /^ enum Type{POINT,DIRECTIONAL,SPOT,AMBIENT};$/;" e enum:vb01::Light::Type EBO mesh.h /^ unsigned int *indices,VAO,VBO,EBO;$/;" m class:vb01::Mesh typeref:typename:unsigned int * +EBO particleEmitter.h /^ unsigned int instanceVBO,VAO,VBO,EBO;$/;" m class:vb01::ParticleEmitter typeref:typename:unsigned int ErrorType shader.h /^ enum ErrorType{VERTEX,FRAGMENT,PROGRAM};$/;" g class:vb01::Shader FAST_BITS stb_image.h /^#define FAST_BITS /;" d FRAGMENT shader.h /^ enum ErrorType{VERTEX,FRAGMENT,PROGRAM};$/;" e enum:vb01::Shader::ErrorType LIGHT_H light.h /^#define LIGHT_H$/;" d Light light.cpp /^ Light::Light(){$/;" f class:vb01::Light Light light.h /^ class Light{$/;" c namespace:vb01 -MATERIAL_2D material.h /^ enum Type{MATERIAL_2D,MATERIAL_SKYBOX};$/;" e enum:vb01::Material::Type +MATERIAL_2D material.h /^ enum Type{MATERIAL_2D,MATERIAL_PARTICLE,MATERIAL_SKYBOX};$/;" e enum:vb01::Material::Type MATERIAL_H material.h /^#define MATERIAL_H$/;" d -MATERIAL_SKYBOX material.h /^ enum Type{MATERIAL_2D,MATERIAL_SKYBOX};$/;" e enum:vb01::Material::Type +MATERIAL_PARTICLE material.h /^ enum Type{MATERIAL_2D,MATERIAL_PARTICLE,MATERIAL_SKYBOX};$/;" e enum:vb01::Material::Type +MATERIAL_SKYBOX material.h /^ enum Type{MATERIAL_2D,MATERIAL_PARTICLE,MATERIAL_SKYBOX};$/;" e enum:vb01::Material::Type MESH_H mesh.h /^#define MESH_H$/;" d MODEL_H model.h /^#define MODEL_H$/;" d Material material.cpp /^ Material::Material(Type type){$/;" f class:vb01::Material @@ -35,8 +37,13 @@ Model model.h /^ class Model : public Node{$/;" c namespace:vb01 NODE_H node.h /^#define NODE_H$/;" d Node node.cpp /^ Node::Node(Vector3 pos){$/;" f class:vb01::Node Node node.h /^ class Node{$/;" c namespace:vb01 +PARTICLE_EMITTER_H particleEmitter.h /^#define PARTICLE_EMITTER_H$/;" d +PI util.h /^ static const float PI=4*atan(1);$/;" v namespace:vb01 typeref:typename:const float POINT light.h /^ enum Type{POINT,DIRECTIONAL,SPOT,AMBIENT};$/;" e enum:vb01::Light::Type PROGRAM shader.h /^ enum ErrorType{VERTEX,FRAGMENT,PROGRAM};$/;" e enum:vb01::Shader::ErrorType +Particle particleEmitter.h /^ struct Particle{$/;" s class:vb01::ParticleEmitter +ParticleEmitter particleEmitter.cpp /^ ParticleEmitter::ParticleEmitter(int numParticles){$/;" f class:vb01::ParticleEmitter +ParticleEmitter particleEmitter.h /^ class ParticleEmitter{$/;" c namespace:vb01 QUAD_H quad.h /^#define QUAD_H$/;" d QUATERNION_H quaternion.h /^#define QUATERNION_H$/;" d QUAT_I quaternion.cpp /^ const quaternion quaternion::QUAT_I(0,1,0,0);$/;" m class:vb01::quaternion typeref:typename:const quaternion @@ -117,28 +124,43 @@ Texture texture.cpp /^ Texture::Texture(string paths[6]){$/;" f class:vb01::Text Texture texture.h /^ class Texture{$/;" c namespace:vb01 TextureType texture.h /^ enum TextureType{TEXTURE_2D,TEXTURE_CUBEMAP};$/;" g class:vb01::Texture Type light.h /^ enum Type{POINT,DIRECTIONAL,SPOT,AMBIENT};$/;" g class:vb01::Light -Type material.h /^ enum Type{MATERIAL_2D,MATERIAL_SKYBOX};$/;" g class:vb01::Material +Type material.h /^ enum Type{MATERIAL_2D,MATERIAL_PARTICLE,MATERIAL_SKYBOX};$/;" g class:vb01::Material +UTIL_H util.h /^#define UTIL_H$/;" d VAO mesh.h /^ unsigned int *indices,VAO,VBO,EBO;$/;" m class:vb01::Mesh typeref:typename:unsigned int * +VAO particleEmitter.h /^ unsigned int instanceVBO,VAO,VBO,EBO;$/;" m class:vb01::ParticleEmitter typeref:typename:unsigned int VBO mesh.h /^ unsigned int *indices,VAO,VBO,EBO;$/;" m class:vb01::Mesh typeref:typename:unsigned int * +VBO particleEmitter.h /^ unsigned int instanceVBO,VAO,VBO,EBO;$/;" m class:vb01::ParticleEmitter typeref:typename:unsigned int VECTOR_H vector.h /^#define VECTOR_H$/;" d VEC_I vector.cpp /^ const Vector2 Vector2::VEC_I(1,0); $/;" m class:vb01::Vector2 typeref:typename:const Vector2 VEC_I vector.cpp /^ const Vector3 Vector3::VEC_I(1,0,0); $/;" m class:vb01::Vector3 typeref:typename:const Vector3 +VEC_I vector.cpp /^ const Vector4 Vector4::VEC_I(1,0,0,0); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 VEC_I vector.h /^ static const Vector2 VEC_IJ, VEC_I,VEC_J,VEC_ZERO;$/;" m struct:vb01::Vector2 typeref:typename:const Vector2 VEC_I vector.h /^ static const Vector3 VEC_IJK, VEC_I,VEC_J,VEC_K,VEC_ZERO;$/;" m struct:vb01::Vector3 typeref:typename:const Vector3 +VEC_I vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 VEC_IJ vector.cpp /^ const Vector2 Vector2::VEC_IJ(1,1); $/;" m class:vb01::Vector2 typeref:typename:const Vector2 VEC_IJ vector.h /^ static const Vector2 VEC_IJ, VEC_I,VEC_J,VEC_ZERO;$/;" m struct:vb01::Vector2 typeref:typename:const Vector2 VEC_IJK vector.cpp /^ const Vector3 Vector3::VEC_IJK(1,1,1); $/;" m class:vb01::Vector3 typeref:typename:const Vector3 VEC_IJK vector.h /^ static const Vector3 VEC_IJK, VEC_I,VEC_J,VEC_K,VEC_ZERO;$/;" m struct:vb01::Vector3 typeref:typename:const Vector3 +VEC_IJKL vector.cpp /^ const Vector4 Vector4::VEC_IJKL(1,1,1,1); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 +VEC_IJKL vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 VEC_J vector.cpp /^ const Vector2 Vector2::VEC_J(0,1); $/;" m class:vb01::Vector2 typeref:typename:const Vector2 VEC_J vector.cpp /^ const Vector3 Vector3::VEC_J(0,1,0); $/;" m class:vb01::Vector3 typeref:typename:const Vector3 +VEC_J vector.cpp /^ const Vector4 Vector4::VEC_J(0,1,0,0); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 VEC_J vector.h /^ static const Vector2 VEC_IJ, VEC_I,VEC_J,VEC_ZERO;$/;" m struct:vb01::Vector2 typeref:typename:const Vector2 VEC_J vector.h /^ static const Vector3 VEC_IJK, VEC_I,VEC_J,VEC_K,VEC_ZERO;$/;" m struct:vb01::Vector3 typeref:typename:const Vector3 +VEC_J vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 VEC_K vector.cpp /^ const Vector3 Vector3::VEC_K(0,0,1); $/;" m class:vb01::Vector3 typeref:typename:const Vector3 +VEC_K vector.cpp /^ const Vector4 Vector4::VEC_K(0,0,1,0); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 VEC_K vector.h /^ static const Vector3 VEC_IJK, VEC_I,VEC_J,VEC_K,VEC_ZERO;$/;" m struct:vb01::Vector3 typeref:typename:const Vector3 +VEC_K vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 +VEC_L vector.cpp /^ const Vector4 Vector4::VEC_L(0,0,0,1); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 +VEC_L vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 VEC_ZERO vector.cpp /^ const Vector2 Vector2::VEC_ZERO(0,0); $/;" m class:vb01::Vector2 typeref:typename:const Vector2 VEC_ZERO vector.cpp /^ const Vector3 Vector3::VEC_ZERO(0,0,0); $/;" m class:vb01::Vector3 typeref:typename:const Vector3 +VEC_ZERO vector.cpp /^ const Vector4 Vector4::VEC_ZERO(0,0,0,0); $/;" m class:vb01::Vector4 typeref:typename:const Vector4 VEC_ZERO vector.h /^ static const Vector2 VEC_IJ, VEC_I,VEC_J,VEC_ZERO;$/;" m struct:vb01::Vector2 typeref:typename:const Vector2 VEC_ZERO vector.h /^ static const Vector3 VEC_IJK, VEC_I,VEC_J,VEC_K,VEC_ZERO;$/;" m struct:vb01::Vector3 typeref:typename:const Vector3 +VEC_ZERO vector.h /^ static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO;$/;" m struct:vb01::Vector4 typeref:typename:const Vector4 VERTEX shader.h /^ enum ErrorType{VERTEX,FRAGMENT,PROGRAM};$/;" e enum:vb01::Shader::ErrorType Vector2 vector.h /^ Vector2(){};$/;" f struct:vb01::Vector2 Vector2 vector.h /^ Vector2(float x,float y){$/;" f struct:vb01::Vector2 @@ -146,7 +168,14 @@ Vector2 vector.h /^ struct Vector2{$/;" s namespace:vb01 Vector3 vector.h /^ Vector3(){};$/;" f struct:vb01::Vector3 Vector3 vector.h /^ Vector3(float x,float y,float z){$/;" f struct:vb01::Vector3 Vector3 vector.h /^ struct Vector3{$/;" s namespace:vb01 +Vector4 vector.h /^ Vector4(){};$/;" f struct:vb01::Vector4 +Vector4 vector.h /^ Vector4(float x,float y,float z,float w){$/;" f struct:vb01::Vector4 +Vector4 vector.h /^ struct Vector4{$/;" s namespace:vb01 Vertex mesh.h /^ struct Vertex{$/;" s class:vb01::Mesh +Vertex particleEmitter.h /^ struct Vertex{$/;" s class:vb01::ParticleEmitter +WATER_PLANE_H waterPlane.h /^#define WATER_PLANE_H$/;" d +WaterPlane waterPlane.cpp /^ WaterPlane::WaterPlane(){}$/;" f class:vb01::WaterPlane +WaterPlane waterPlane.h /^ class WaterPlane{$/;" c namespace:vb01 YCbCr_to_RGB_kernel stb_image.h /^ void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc/;" m struct:__anon84e4e8860808 typeref:typename:void (*)(stbi_uc * out,const stbi_uc * y,const stbi_uc * pcb,const stbi_uc * pcr,int count,int step) __anon84e4e8860103 stb_image.h /^{$/;" g __anon84e4e8860208 stb_image.h /^{$/;" s @@ -176,6 +205,7 @@ all_a stb_image.h /^ unsigned int mr,mg,mb,ma, all_a;$/;" m struct:__anon84e4e app14_color_transform stb_image.h /^ int app14_color_transform; \/\/ Adobe APP14 tag$/;" m struct:__anon84e4e8860808 typeref:typename:int attachChild node.cpp /^ void Node::attachChild(Node *child){$/;" f class:vb01::Node typeref:typename:void attachMesh node.cpp /^ void Node::attachMesh(Mesh *mesh){$/;" f class:vb01::Node typeref:typename:void +attachParticleEmitter node.cpp /^ void Node::attachParticleEmitter(ParticleEmitter *emitter){$/;" f class:vb01::Node typeref:typename:void attenuationValues light.h /^ Vector3 pos,color,attenuationValues=Vector3(1.8,.7,1),direction;$/;" m class:vb01::Light typeref:typename:Vector3 background stb_image.h /^ stbi_uc *background; \/\/ The current "background" as far as a gif is concerned$/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc * bgindex stb_image.h /^ int flags, bgindex, ratio, transparent, eflags;$/;" m struct:__anon84e4e8861308 typeref:typename:int @@ -197,6 +227,7 @@ coeff stb_image.h /^ short *coeff; \/\/ progressive only$/;" m struct:_ coeff_h stb_image.h /^ int coeff_w, coeff_h; \/\/ number of 8x8 coefficient blocks$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int coeff_w stb_image.h /^ int coeff_w, coeff_h; \/\/ number of 8x8 coefficient blocks$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int color light.h /^ Vector3 pos,color,attenuationValues=Vector3(1.8,.7,1),direction;$/;" m class:vb01::Light typeref:typename:Vector3 +color particleEmitter.h /^ Vector4 color;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:Vector4 color_table stb_image.h /^ stbi_uc *color_table;$/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc * conj quaternion.h /^ inline vb01::quaternion conj(){return (*this+vb01::quaternion(0,1,0,0)*(*this)*vb01::quaterni/;" f class:vb01::quaternion typeref:typename:vb01::quaternion construct mesh.cpp /^ void Mesh::construct(){$/;" f class:vb01::Mesh typeref:typename:void @@ -235,12 +266,17 @@ depth stb_image.h /^ int depth;$/;" m struct:__anon84e4e8860e08 typeref:typena dequant stb_image.h /^ stbi__uint16 dequant[4][64];$/;" m struct:__anon84e4e8860808 typeref:typename:stbi__uint16[4][64] descendants node.h /^ std::vector children,descendants;$/;" m class:vb01::Node typeref:typename:std::vector diffuseMapTextures material.h /^ std::vector diffuseMapTextures,normalMapTextures,specularMapTextures;$/;" m class:vb01::Material typeref:typename:std::vector +dir particleEmitter.h /^ Vector3 dir;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:Vector3 direction camera.h /^ Vector3 position=Vector3(0,0,0),direction=Vector3(0,0,1),left=Vector3(1,0,0),up=Vector3(0,1,0/;" m class:vb01::Camera typeref:typename:Vector3 direction light.h /^ Vector3 pos,color,attenuationValues=Vector3(1.8,.7,1),direction;$/;" m class:vb01::Light typeref:typename:Vector3 +direction particleEmitter.h /^ Vector3 direction=Vector3(0,1,0);$/;" m class:vb01::ParticleEmitter typeref:typename:Vector3 dot vector.h /^ float dot(Vector2 v){return x*v.x+y*v.y;}$/;" f struct:vb01::Vector2 typeref:typename:float dot vector.h /^ float dot(Vector3 v){return x*v.x+y*v.y+z*v.z;}$/;" f struct:vb01::Vector3 typeref:typename:float editShader shader.cpp /^ void Shader::editShader(bool vertexShader, char firstChar, char secondChar, string insertion){$/;" f class:vb01::Shader typeref:typename:void eflags stb_image.h /^ int flags, bgindex, ratio, transparent, eflags;$/;" m struct:__anon84e4e8861308 typeref:typename:int +emitters node.h /^ std::vector emitters;$/;" m class:vb01::Node typeref:typename:std::vector +endColor particleEmitter.h /^ Vector4 startColor,endColor;$/;" m class:vb01::ParticleEmitter typeref:typename:Vector4 +endSize particleEmitter.h /^ Vector2 startSize=Vector2::VEC_IJ,endSize=Vector2::VEC_IJ;$/;" m class:vb01::ParticleEmitter typeref:typename:Vector2 eob_run stb_image.h /^ int eob_run;$/;" m struct:__anon84e4e8860808 typeref:typename:int eof stb_image.h /^ int (*eof) (void *user); \/\/ returns nonzero if we are at end o/;" m struct:__anon84e4e8860208 typeref:typename:int (*)(void * user) expanded stb_image.h /^ stbi_uc *idata, *expanded, *out;$/;" m struct:__anon84e4e8860e08 typeref:typename:stbi_uc ** @@ -264,6 +300,7 @@ getChildren node.h /^ inline std::vector& getChildren(){return children getDescendants node.h /^ inline std::vector& getDescendants(){return descendants;}$/;" f class:vb01::Node typeref:typename:std::vector & getDirection camera.h /^ inline Vector3 getDirection(){return direction;}$/;" f class:vb01::Camera typeref:typename:Vector3 getDirection light.h /^ inline Vector3 getDirection(){return direction;}$/;" f class:vb01::Light typeref:typename:Vector3 +getDistanceFrom vector.h /^ float getDistanceFrom(Vector3 v){return (v-*this).getLengthSq();}$/;" f struct:vb01::Vector3 typeref:typename:float getFarPlane camera.h /^ inline float getFarPlane(){return farPlane;}$/;" f class:vb01::Camera typeref:typename:float getFov camera.h /^ inline float getFov(){return fov;}$/;" f class:vb01::Camera typeref:typename:float getHeight root.h /^ inline int getHeight(){return height;}$/;" f class:vb01::Root typeref:typename:int @@ -290,6 +327,7 @@ getPosition node.h /^ inline Vector3 getPosition(){return pos;}$/;" f class:vb getRootNode root.h /^ inline Node* getRootNode(){return rootNode;}$/;" f class:vb01::Root typeref:typename:Node * getShader material.h /^ inline Shader* getShader(){return shader;}$/;" f class:vb01::Material typeref:typename:Shader * getSingleton root.cpp /^ Root* Root::getSingleton(){return root;}$/;" f class:vb01::Root typeref:typename:Root * +getTime util.h /^ inline s64 getTime(){return s64(std::chrono::system_clock::now().time_since_epoch()\/std::chron/;" f namespace:vb01 typeref:typename:s64 getUp camera.h /^ inline Vector3 getUp(){return up;}$/;" f class:vb01::Camera typeref:typename:Vector3 getWidth root.h /^ inline int getWidth(){return width;}$/;" f class:vb01::Root typeref:typename:int h stb_image.h /^ int h,v;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int @@ -299,6 +337,7 @@ ha stb_image.h /^ int hd,ha;$/;" m struct:__anon84e4e8860808::__anon84e4e88 hd stb_image.h /^ int hd,ha;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int height root.h /^ int width,height;$/;" m class:vb01::Root typeref:typename:int height texture.h /^ int width,height,numChannels;$/;" m class:vb01::Texture typeref:typename:int +highLife particleEmitter.h /^ float spread=0,lowLife=1,highLife=2;$/;" m class:vb01::ParticleEmitter typeref:typename:float history stb_image.h /^ stbi_uc *history; $/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc * hs stb_image.h /^ int hs,vs; \/\/ expansion factor in each axis$/;" m struct:__anon84e4e8860a08 typeref:typename:int hsz stb_image.h /^ int bpp, offset, hsz;$/;" m struct:__anon84e4e8861008 typeref:typename:int @@ -325,6 +364,7 @@ img_x stb_image.h /^ stbi__uint32 img_x, img_y;$/;" m struct:__anon84e4e886030 img_y stb_image.h /^ stbi__uint32 img_x, img_y;$/;" m struct:__anon84e4e8860308 typeref:typename:stbi__uint32 indices mesh.h /^ unsigned int *indices,VAO,VBO,EBO;$/;" m class:vb01::Mesh typeref:typename:unsigned int * innerAngle light.h /^ float innerAngle=.707,outerAngle=.714;$/;" m class:vb01::Light typeref:typename:float +instanceVBO particleEmitter.h /^ unsigned int instanceVBO,VAO,VBO,EBO;$/;" m class:vb01::ParticleEmitter typeref:typename:unsigned int io stb_image.h /^ stbi_io_callbacks io;$/;" m struct:__anon84e4e8860308 typeref:typename:stbi_io_callbacks io_user_data stb_image.h /^ void *io_user_data;$/;" m struct:__anon84e4e8860308 typeref:typename:void * isLightingEnabled material.h /^ inline bool isLightingEnabled(){return lightingEnabled;}$/;" f class:vb01::Material typeref:typename:bool @@ -341,12 +381,15 @@ linebuf stb_image.h /^ stbi_uc *linebuf;$/;" m struct:__anon84e4e8860808::_ loadShaders shader.cpp /^ void Shader::loadShaders(){$/;" f class:vb01::Shader typeref:typename:void load_jpeg_image stb_image.h /^static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)$/;" f typeref:typename:stbi_uc * lookAt camera.cpp /^ void Camera::lookAt(Vector3 direction, Vector3 up){$/;" f class:vb01::Camera typeref:typename:void +lowLife particleEmitter.h /^ float spread=0,lowLife=1,highLife=2;$/;" m class:vb01::ParticleEmitter typeref:typename:float lpal stb_image.h /^ stbi_uc lpal[256][4];$/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc[256][4] ma stb_image.h /^ unsigned int mr,mg,mb,ma, all_a;$/;" m struct:__anon84e4e8861008 typeref:typename:unsigned int main main.cpp /^int main(){$/;" f typeref:typename:int marker stb_image.h /^ unsigned char marker; \/\/ marker seen while filling entropy buffer$/;" m struct:__anon84e4e8860808 typeref:typename:unsigned char +mat particleEmitter.h /^ glm::mat4 mat;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:glm::mat4 material mesh.h /^ Material *material=nullptr;$/;" m class:vb01::Mesh typeref:typename:Material * material model.h /^ Material* material;$/;" m class:vb01::Model typeref:typename:Material * +material particleEmitter.h /^ Material *material=nullptr;$/;" m class:vb01::ParticleEmitter typeref:typename:Material * max_x stb_image.h /^ int max_x, max_y;$/;" m struct:__anon84e4e8861308 typeref:typename:int max_y stb_image.h /^ int max_x, max_y;$/;" m struct:__anon84e4e8861308 typeref:typename:int maxcode stb_image.h /^ int maxcode[17];$/;" m struct:__anon84e4e8860b08 typeref:typename:int[17] @@ -361,6 +404,7 @@ name mesh.h /^ std::string name="";$/;" m class:vb01::Mesh typeref:typename:st nearPlane camera.h /^ float fov=45,nearPlane=.1,farPlane=100;$/;" m class:vb01::Camera typeref:typename:float node light.h /^ Node *node=nullptr;$/;" m class:vb01::Light typeref:typename:Node * node mesh.h /^ Node *node=nullptr;$/;" m class:vb01::Mesh typeref:typename:Node * +node particleEmitter.h /^ Node *node=nullptr;$/;" m class:vb01::ParticleEmitter typeref:typename:Node * nomore stb_image.h /^ int nomore; \/\/ flag if we saw a marker so must stop$/;" m struct:__anon84e4e8860808 typeref:typename:int norm mesh.h /^ Vector3 pos,norm;$/;" m struct:vb01::Mesh::Vertex typeref:typename:Vector3 norm quaternion.h /^ inline vb01::quaternion norm(){return *this\/getLength();}$/;" f class:vb01::quaternion typeref:typename:vb01::quaternion @@ -368,6 +412,7 @@ norm vector.h /^ Vector2 norm(){return *this\/getLength();}$/;" f struct:vb01:: norm vector.h /^ Vector3 norm(){return *this\/getLength();}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 normalMapTextures material.h /^ std::vector diffuseMapTextures,normalMapTextures,specularMapTextures;$/;" m class:vb01::Material typeref:typename:std::vector numChannels texture.h /^ int width,height,numChannels;$/;" m class:vb01::Texture typeref:typename:int +numParticles particleEmitter.h /^ int numParticles;$/;" m class:vb01::ParticleEmitter typeref:typename:int numTris mesh.h /^ int numTris;$/;" m class:vb01::Mesh typeref:typename:int num_bits stb_image.h /^ int num_bits;$/;" m struct:__anon84e4e8860c08 typeref:typename:int num_channels stb_image.h /^ int num_channels;$/;" m struct:__anon84e4e8860508 typeref:typename:int @@ -376,16 +421,25 @@ operator * quaternion.h /^ inline vb01::quaternion operator* (vb01::quaternion operator * quaternion.h /^ template inline vb01::quaternion operator*(T s){return quaternion(w*s,x*s,y*s,z*s/;" f class:vb01::quaternion typeref:typename:vb01::quaternion operator * vector.h /^ templateVector2 operator*(T s){return Vector2(x*s,y*s);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 operator * vector.h /^ templateVector3 operator*(T s){return Vector3(x*s,y*s,z*s);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator * vector.h /^ templateVector4 operator*(T s){return Vector4(x*s,y*s,z*s,w*s);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 operator + quaternion.h /^ inline vb01::quaternion operator+(quaternion q){return quaternion(w+q.w,x+q.x,y+q.y,z+q.z);}$/;" f class:vb01::quaternion typeref:typename:vb01::quaternion +operator + vector.h /^ Vector2 operator+(const Vector2 &v){return Vector2(x+v.x,y+v.y);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 +operator + vector.h /^ Vector3 operator+(const Vector3 &v){return Vector3(x+v.x,y+v.y,z+v.z);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator + vector.h /^ Vector4 operator+(const Vector4 &v){return Vector4(x+v.x,y+v.y,z+v.z,w+v.w);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 operator + vector.h /^ templateVector2 operator+(T s){return Vector2(x+s,y+s);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 operator + vector.h /^ templateVector3 operator+(T s){return Vector3(x+s,y+s,z+s);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator + vector.h /^ templateVector4 operator+(T s){return Vector4(x+s,y+s,z+s,w+s);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 operator - quaternion.h /^ inline vb01::quaternion operator-(quaternion q){return quaternion(w-q.w,x-q.x,y-q.y,z-q.z);}$/;" f class:vb01::quaternion typeref:typename:vb01::quaternion -operator - vector.h /^ Vector3 operator-(const Vector3 &v){return *this;}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator - vector.h /^ Vector2 operator-(const Vector2 &v){return Vector2(x-v.x,y-v.y);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 +operator - vector.h /^ Vector3 operator-(const Vector3 &v){return Vector3(x-v.x,y-v.y,z-v.z);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator - vector.h /^ Vector4 operator-(const Vector4 &v){return Vector4(x-v.x,y-v.y,z-v.z,w-v.w);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 operator - vector.h /^ templateVector2 operator-(T s){return Vector2(x-s,y-s);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 operator - vector.h /^ templateVector3 operator-(T s){return Vector3(x-s,y-s,z-s);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator - vector.h /^ templateVector4 operator-(T s){return Vector4(x-s,y-s,z-s,w-s);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 operator / quaternion.h /^ inline vb01::quaternion operator\/ (float f){return quaternion(w\/f,x\/f,y\/f,z\/f);}$/;" f class:vb01::quaternion typeref:typename:vb01::quaternion operator / vector.h /^ templateVector2 operator\/(T s){return Vector2(x\/s,y\/s);}$/;" f struct:vb01::Vector2 typeref:typename:Vector2 operator / vector.h /^ templateVector3 operator\/(T s){return Vector3(x\/s,y\/s,z\/s);}$/;" f struct:vb01::Vector3 typeref:typename:Vector3 +operator / vector.h /^ templateVector4 operator\/(T s){return Vector4(x\/s,y\/s,z\/s,w\/s);}$/;" f struct:vb01::Vector4 typeref:typename:Vector4 order stb_image.h /^ int scan_n, order[4];$/;" m struct:__anon84e4e8860808 typeref:typename:int[4] out stb_image.h /^ stbi_uc *idata, *expanded, *out;$/;" m struct:__anon84e4e8860e08 typeref:typename:stbi_uc *** out stb_image.h /^ stbi_uc *out; \/\/ output buffer (always 4 components)$/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc * @@ -393,9 +447,11 @@ outerAngle light.h /^ float innerAngle=.707,outerAngle=.714;$/;" m class:vb01: pal stb_image.h /^ stbi_uc pal[256][4];$/;" m struct:__anon84e4e8861308 typeref:typename:stbi_uc[256][4] parent node.h /^ Node *parent=nullptr;$/;" m class:vb01::Node typeref:typename:Node * parse stb_image.h /^ int parse, step;$/;" m struct:__anon84e4e8861308 typeref:typename:int +particles particleEmitter.h /^ Particle *particles;$/;" m class:vb01::ParticleEmitter typeref:typename:Particle * pos light.h /^ Vector3 pos,color,attenuationValues=Vector3(1.8,.7,1),direction;$/;" m class:vb01::Light typeref:typename:Vector3 pos mesh.h /^ Vector3 pos,norm;$/;" m struct:vb01::Mesh::Vertex typeref:typename:Vector3 pos node.h /^ Vector3 pos;$/;" m class:vb01::Node typeref:typename:Vector3 +pos particleEmitter.h /^ Vector3 pos;$/;" m struct:vb01::ParticleEmitter::Vertex typeref:typename:Vector3 position camera.h /^ Vector3 position=Vector3(0,0,0),direction=Vector3(0,0,1),left=Vector3(1,0,0),up=Vector3(0,1,0/;" m class:vb01::Camera typeref:typename:Vector3 prefix stb_image.h /^ stbi__int16 prefix;$/;" m struct:__anon84e4e8861208 typeref:typename:stbi__int16 processMesh model.cpp /^ void Model::processMesh(aiMesh *mesh, const aiScene *scene, Node *currentNode){$/;" f class:vb01::Model typeref:typename:void @@ -420,6 +476,10 @@ rootNode root.h /^ Node *rootNode;$/;" m class:vb01::Root typeref:typename:Nod running root.h /^ bool running=false;$/;" m class:vb01::Root typeref:typename:bool s stb_image.h /^ stbi__context *s;$/;" m struct:__anon84e4e8860808 typeref:typename:stbi__context * s stb_image.h /^ stbi__context *s;$/;" m struct:__anon84e4e8860e08 typeref:typename:stbi__context * +s16 util.h /^ typedef short s16;$/;" t namespace:vb01 typeref:typename:short +s32 util.h /^ typedef int s32;$/;" t namespace:vb01 typeref:typename:int +s64 util.h /^ typedef long long s64;$/;" t namespace:vb01 typeref:typename:long long +s8 util.h /^ typedef char s8;$/;" t namespace:vb01 typeref:typename:char scan_n stb_image.h /^ int scan_n, order[4];$/;" m struct:__anon84e4e8860808 typeref:typename:int select texture.cpp /^ void Texture::select(){$/;" f class:vb01::Texture typeref:typename:void setAttenuationValues light.h /^ inline void setAttenuationValues(float a, float b, float c){$/;" f class:vb01::Light typeref:typename:void @@ -433,14 +493,19 @@ setLightingEnabled material.h /^ inline void setLightingEnabled(bool lighting) setMat4 shader.cpp /^ void Shader::setMat4(mat4 mat, string var){$/;" f class:vb01::Shader typeref:typename:void setMaterial mesh.h /^ void setMaterial(Material *mat){this->material=mat;}$/;" f class:vb01::Mesh typeref:typename:void setMaterial model.cpp /^ void Model::setMaterial(Material *mat){$/;" f class:vb01::Model typeref:typename:void +setMaterial particleEmitter.h /^ inline void setMaterial(Material *mat){this->material=mat;}$/;" f class:vb01::ParticleEmitter typeref:typename:void setNode light.h /^ inline void setNode(Node *node){this->node=node;}$/;" f class:vb01::Light typeref:typename:void setNode mesh.h /^ inline void setNode(Node *node){this->node=node;}$/;" f class:vb01::Mesh typeref:typename:void +setNode particleEmitter.h /^ inline void setNode(Node *node){this->node=node;}$/;" f class:vb01::ParticleEmitter typeref:typename:void setOuterAngle light.h /^ inline void setOuterAngle(float outerAngle){this->outerAngle=outerAngle;}$/;" f class:vb01::Light typeref:typename:void setPosition camera.h /^ void setPosition(Vector3 position){this->position=position;}$/;" f class:vb01::Camera typeref:typename:void setPosition light.h /^ inline void setPosition(Vector3 pos){this->pos=pos;}$/;" f class:vb01::Light typeref:typename:void setType light.h /^ inline void setType(Type t){this->type=t;}$/;" f class:vb01::Light typeref:typename:void -setVec3 shader.cpp /^ void Shader::setVec3(vec3 vec, string var){$/;" f class:vb01::Shader typeref:typename:void +setVec2 shader.cpp /^ void Shader::setVec2(Vector2 vec, string var){$/;" f class:vb01::Shader typeref:typename:void +setVec3 shader.cpp /^ void Shader::setVec3(Vector3 vec, string var){$/;" f class:vb01::Shader typeref:typename:void +setVec4 shader.cpp /^ void Shader::setVec4(Vector4 vec, string var){$/;" f class:vb01::Shader typeref:typename:void shader material.h /^ Shader *shader=nullptr;$/;" m class:vb01::Material typeref:typename:Shader * +size particleEmitter.h /^ Vector2 size;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:Vector2 size stb_image.h /^ stbi_uc size[257];$/;" m struct:__anon84e4e8860708 typeref:typename:stbi_uc[257] size stb_image.h /^ stbi_uc size[288];$/;" m struct:__anon84e4e8860b08 typeref:typename:stbi_uc[288] size stb_image.h /^ stbi_uc size,type,channel;$/;" m struct:__anon84e4e8861108 typeref:typename:stbi_uc @@ -449,7 +514,10 @@ skybox root.h /^ Box *skybox=nullptr;$/;" m class:vb01::Root typeref:typename: spec_end stb_image.h /^ int spec_end;$/;" m struct:__anon84e4e8860808 typeref:typename:int spec_start stb_image.h /^ int spec_start;$/;" m struct:__anon84e4e8860808 typeref:typename:int specularMapTextures material.h /^ std::vector diffuseMapTextures,normalMapTextures,specularMapTextures;$/;" m class:vb01::Material typeref:typename:std::vector +spread particleEmitter.h /^ float spread=0,lowLife=1,highLife=2;$/;" m class:vb01::ParticleEmitter typeref:typename:float start root.cpp /^ void Root::start(int width,int height){$/;" f class:vb01::Root typeref:typename:void +startColor particleEmitter.h /^ Vector4 startColor,endColor;$/;" m class:vb01::ParticleEmitter typeref:typename:Vector4 +startSize particleEmitter.h /^ Vector2 startSize=Vector2::VEC_IJ,endSize=Vector2::VEC_IJ;$/;" m class:vb01::ParticleEmitter typeref:typename:Vector2 start_x stb_image.h /^ int start_x, start_y;$/;" m struct:__anon84e4e8861308 typeref:typename:int start_y stb_image.h /^ int start_x, start_y;$/;" m struct:__anon84e4e8861308 typeref:typename:int stbi__DNL stb_image.h /^#define stbi__DNL(/;" d @@ -724,7 +792,10 @@ succ_high stb_image.h /^ int succ_high;$/;" m struct:__anon84e4e886 succ_low stb_image.h /^ int succ_low;$/;" m struct:__anon84e4e8860808 typeref:typename:int suffix stb_image.h /^ stbi_uc suffix;$/;" m struct:__anon84e4e8861208 typeref:typename:stbi_uc texCoords mesh.h /^ Vector2 texCoords; $/;" m struct:vb01::Mesh::Vertex typeref:typename:Vector2 +texCoords particleEmitter.h /^ Vector2 texCoords;$/;" m struct:vb01::ParticleEmitter::Vertex typeref:typename:Vector2 texture texture.h /^ unsigned int texture;$/;" m class:vb01::Texture typeref:typename:unsigned int +time particleEmitter.h /^ s64 time=0,timeToLive=0;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:s64 +timeToLive particleEmitter.h /^ s64 time=0,timeToLive=0;$/;" m struct:vb01::ParticleEmitter::Particle typeref:typename:s64 todo stb_image.h /^ int restart_interval, todo;$/;" m struct:__anon84e4e8860808 typeref:typename:int tq stb_image.h /^ int tq;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int transparent stb_image.h /^ int flags, bgindex, ratio, transparent, eflags;$/;" m struct:__anon84e4e8861308 typeref:typename:int @@ -733,6 +804,10 @@ type material.h /^ Type type;$/;" m class:vb01::Material typeref:typename:Type type stb_image.h /^ stbi__uint32 type;$/;" m struct:__anon84e4e8860d08 typeref:typename:stbi__uint32 type stb_image.h /^ stbi_uc size,type,channel;$/;" m struct:__anon84e4e8861108 typeref:typename:stbi_uc type texture.h /^ TextureType type;$/;" m class:vb01::Texture typeref:typename:TextureType +u16 util.h /^ typedef unsigned short u16;$/;" t namespace:vb01 typeref:typename:unsigned short +u32 util.h /^ typedef unsigned int u32;$/;" t namespace:vb01 typeref:typename:unsigned int +u64 util.h /^ typedef unsigned long long u64;$/;" t namespace:vb01 typeref:typename:unsigned long long +u8 util.h /^ typedef unsigned char u8;$/;" t namespace:vb01 typeref:typename:unsigned char up camera.h /^ Vector3 position=Vector3(0,0,0),direction=Vector3(0,0,1),left=Vector3(1,0,0),up=Vector3(0,1,0/;" m class:vb01::Camera typeref:typename:Vector3 update camera.cpp /^ void Camera::update(){$/;" f class:vb01::Camera typeref:typename:void update light.cpp /^ void Light::update(){$/;" f class:vb01::Light typeref:typename:void @@ -740,6 +815,7 @@ update material.cpp /^ void Material::update(){$/;" f class:vb01::Material typer update mesh.cpp /^ void Mesh::update(){$/;" f class:vb01::Mesh typeref:typename:void update model.cpp /^ void Model::update(){$/;" f class:vb01::Model typeref:typename:void update node.cpp /^ void Node::update(){$/;" f class:vb01::Node typeref:typename:void +update particleEmitter.cpp /^ void ParticleEmitter::update(){$/;" f class:vb01::ParticleEmitter typeref:typename:void update root.cpp /^ void Root::update(){$/;" f class:vb01::Root typeref:typename:void use shader.cpp /^ void Shader::use(){glUseProgram(id);}$/;" f class:vb01::Shader typeref:typename:void v stb_image.h /^ int h,v;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int @@ -761,6 +837,8 @@ vb01 model.cpp /^namespace vb01{$/;" n file: vb01 model.h /^namespace vb01{$/;" n vb01 node.cpp /^namespace vb01{$/;" n file: vb01 node.h /^namespace vb01{$/;" n +vb01 particleEmitter.cpp /^namespace vb01{$/;" n file: +vb01 particleEmitter.h /^namespace vb01{$/;" n vb01 quad.cpp /^namespace vb01{$/;" n file: vb01 quad.h /^namespace vb01{$/;" n vb01 quaternion.cpp /^namespace vb01{$/;" n file: @@ -771,12 +849,17 @@ vb01 shader.cpp /^namespace vb01{$/;" n file: vb01 shader.h /^namespace vb01{$/;" n vb01 texture.cpp /^namespace vb01{$/;" n file: vb01 texture.h /^namespace vb01{$/;" n +vb01 util.cpp /^namespace vb01{$/;" n file: +vb01 util.h /^namespace vb01{$/;" n vb01 vector.cpp /^namespace vb01{$/;" n file: vb01 vector.h /^namespace vb01{$/;" n +vb01 waterPlane.cpp /^namespace vb01{$/;" n file: +vb01 waterPlane.h /^namespace vb01{$/;" n vertices mesh.h /^ Vertex *vertices;$/;" m class:vb01::Mesh typeref:typename:Vertex * vs stb_image.h /^ int hs,vs; \/\/ expansion factor in each axis$/;" m struct:__anon84e4e8860a08 typeref:typename:int w quaternion.h /^ float w,x,y,z;$/;" m class:vb01::quaternion typeref:typename:float w stb_image.h /^ int w,h;$/;" m struct:__anon84e4e8861308 typeref:typename:int +w vector.h /^ float x,y,z,w;$/;" m struct:vb01::Vector4 typeref:typename:float w2 stb_image.h /^ int x,y,w2,h2;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int w_lores stb_image.h /^ int w_lores; \/\/ horizontal pixels pre-expansion$/;" m struct:__anon84e4e8860a08 typeref:typename:int weight texture.h /^ float weight;$/;" m class:vb01::Texture typeref:typename:float @@ -785,15 +868,18 @@ width texture.h /^ int width,height,numChannels;$/;" m class:vb01::Texture typ window root.h /^ GLFWwindow *window;$/;" m class:vb01::Root typeref:typename:GLFWwindow * x quaternion.h /^ float w,x,y,z;$/;" m class:vb01::quaternion typeref:typename:float x stb_image.h /^ int x,y,w2,h2;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int +x vector.h /^ float x,y,z,w;$/;" m struct:vb01::Vector4 typeref:typename:float x vector.h /^ float x,y,z;$/;" m struct:vb01::Vector3 typeref:typename:float x vector.h /^ float x,y;$/;" m struct:vb01::Vector2 typeref:typename:float y quaternion.h /^ float w,x,y,z;$/;" m class:vb01::quaternion typeref:typename:float y stb_image.h /^ int x,y,w2,h2;$/;" m struct:__anon84e4e8860808::__anon84e4e8860908 typeref:typename:int +y vector.h /^ float x,y,z,w;$/;" m struct:vb01::Vector4 typeref:typename:float y vector.h /^ float x,y,z;$/;" m struct:vb01::Vector3 typeref:typename:float y vector.h /^ float x,y;$/;" m struct:vb01::Vector2 typeref:typename:float ypos stb_image.h /^ int ypos; \/\/ which pre-expansion row we're on$/;" m struct:__anon84e4e8860a08 typeref:typename:int ystep stb_image.h /^ int ystep; \/\/ how far through vertical expansion we are$/;" m struct:__anon84e4e8860a08 typeref:typename:int z quaternion.h /^ float w,x,y,z;$/;" m class:vb01::quaternion typeref:typename:float +z vector.h /^ float x,y,z,w;$/;" m struct:vb01::Vector4 typeref:typename:float z vector.h /^ float x,y,z;$/;" m struct:vb01::Vector3 typeref:typename:float z_distance stb_image.h /^ stbi__zhuffman z_length, z_distance;$/;" m struct:__anon84e4e8860c08 typeref:typename:stbi__zhuffman z_expandable stb_image.h /^ int z_expandable;$/;" m struct:__anon84e4e8860c08 typeref:typename:int @@ -809,3 +895,4 @@ zout_start stb_image.h /^ char *zout_start;$/;" m struct:__anon84e4e8860c08 ty ~Mesh mesh.cpp /^ Mesh::~Mesh(){}$/;" f class:vb01::Mesh ~Model model.cpp /^ Model::~Model(){}$/;" f class:vb01::Model ~Node node.cpp /^ Node::~Node(){}$/;" f class:vb01::Node +~ParticleEmitter particleEmitter.cpp /^ ParticleEmitter::~ParticleEmitter(){}$/;" f class:vb01::ParticleEmitter diff --git a/util.cpp b/util.cpp new file mode 100644 index 0000000..33c2079 --- /dev/null +++ b/util.cpp @@ -0,0 +1,5 @@ +#include"util.h" + +namespace vb01{ + +} diff --git a/util.h b/util.h new file mode 100644 index 0000000..0b1b99f --- /dev/null +++ b/util.h @@ -0,0 +1,23 @@ +#ifndef UTIL_H +#define UTIL_H + +#include +#include + +namespace vb01{ + typedef char s8; + typedef short s16; + typedef int s32; + typedef long long s64; + + typedef unsigned char u8; + typedef unsigned short u16; + typedef unsigned int u32; + typedef unsigned long long u64; + + static const float PI=4*atan(1); + + inline s64 getTime(){return s64(std::chrono::system_clock::now().time_since_epoch()/std::chrono::milliseconds(1));} +} + +#endif diff --git a/vector.cpp b/vector.cpp index 012b545..a80c9b9 100644 --- a/vector.cpp +++ b/vector.cpp @@ -11,4 +11,11 @@ namespace vb01{ const Vector3 Vector3::VEC_J(0,1,0); const Vector3 Vector3::VEC_K(0,0,1); const Vector3 Vector3::VEC_ZERO(0,0,0); + + const Vector4 Vector4::VEC_IJKL(1,1,1,1); + const Vector4 Vector4::VEC_I(1,0,0,0); + const Vector4 Vector4::VEC_J(0,1,0,0); + const Vector4 Vector4::VEC_K(0,0,1,0); + const Vector4 Vector4::VEC_L(0,0,0,1); + const Vector4 Vector4::VEC_ZERO(0,0,0,0); } diff --git a/vector.h b/vector.h index 1d63c54..658d65b 100644 --- a/vector.h +++ b/vector.h @@ -4,6 +4,25 @@ #include namespace vb01{ + struct Vector4{ + Vector4(){}; + Vector4(float x,float y,float z,float w){ + this->x=x; + this->y=y; + this->z=z; + this->w=w; + } + Vector4 operator-(const Vector4 &v){return Vector4(x-v.x,y-v.y,z-v.z,w-v.w);} + Vector4 operator+(const Vector4 &v){return Vector4(x+v.x,y+v.y,z+v.z,w+v.w);} + templateVector4 operator+(T s){return Vector4(x+s,y+s,z+s,w+s);} + templateVector4 operator-(T s){return Vector4(x-s,y-s,z-s,w-s);} + templateVector4 operator*(T s){return Vector4(x*s,y*s,z*s,w*s);} + templateVector4 operator/(T s){return Vector4(x/s,y/s,z/s,w/s);} + + float x,y,z,w; + static const Vector4 VEC_IJKL, VEC_I, VEC_J, VEC_K, VEC_L, VEC_ZERO; + }; + struct Vector3{ Vector3(){}; Vector3(float x,float y,float z){ @@ -11,7 +30,8 @@ namespace vb01{ this->y=y; this->z=z; } - Vector3 operator-(const Vector3 &v){return *this;} + Vector3 operator-(const Vector3 &v){return Vector3(x-v.x,y-v.y,z-v.z);} + Vector3 operator+(const Vector3 &v){return Vector3(x+v.x,y+v.y,z+v.z);} templateVector3 operator+(T s){return Vector3(x+s,y+s,z+s);} templateVector3 operator-(T s){return Vector3(x-s,y-s,z-s);} templateVector3 operator*(T s){return Vector3(x*s,y*s,z*s);} @@ -20,6 +40,7 @@ namespace vb01{ float getLength(){return std::sqrt(getLengthSq());} float dot(Vector3 v){return x*v.x+y*v.y+z*v.z;} float getAngleBetween(Vector3 v){return std::acos(dot(v));} + float getDistanceFrom(Vector3 v){return (v-*this).getLengthSq();} Vector3 norm(){return *this/getLength();} Vector3 cross(Vector3 v){return Vector3(y*v.z-v.y*z,x*v.z-v.x*z,x*v.y-v.x*y);} @@ -33,6 +54,8 @@ namespace vb01{ this->x=x; this->y=y; } + Vector2 operator-(const Vector2 &v){return Vector2(x-v.x,y-v.y);} + Vector2 operator+(const Vector2 &v){return Vector2(x+v.x,y+v.y);} templateVector2 operator+(T s){return Vector2(x+s,y+s);} templateVector2 operator-(T s){return Vector2(x-s,y-s);} templateVector2 operator*(T s){return Vector2(x*s,y*s);} diff --git a/waterPlane.cpp b/waterPlane.cpp new file mode 100644 index 0000000..6bb5321 --- /dev/null +++ b/waterPlane.cpp @@ -0,0 +1,5 @@ +#include"waterPlane.h" + +namespace vb01{ + WaterPlane::WaterPlane(){} +} diff --git a/waterPlane.h b/waterPlane.h new file mode 100644 index 0000000..e510694 --- /dev/null +++ b/waterPlane.h @@ -0,0 +1,12 @@ +#ifndef WATER_PLANE_H +#define WATER_PLANE_H + +namespace vb01{ + class WaterPlane{ + public: + WaterPlane(); + private: + }; +} + +#endif