Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
7.21
Browse files Browse the repository at this point in the history
  • Loading branch information
bowling233 committed Jul 21, 2021
1 parent 3efbd47 commit c2639e3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
4 changes: 3 additions & 1 deletion OpenGLProject/OpenGLProject.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="Collision.cpp" />
<ClCompile Include="main_test.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Object.cpp" />
<ClCompile Include="Sphere.cpp" />
<ClCompile Include="Utils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Collision.h" />
Expand Down
8 changes: 7 additions & 1 deletion OpenGLProject/OpenGLProject.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
<ClCompile Include="Collision.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main_test.cpp">
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Sphere.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Utils.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
Expand Down
18 changes: 10 additions & 8 deletions OpenGLProject/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ void setupVert_coord(void)
{
glUseProgram(coordRenderingProgram);
float vertCoordPositions[18] = {
-1000.f, 0.0f, 0.0f, 1000.f, 0.0f, 0.0f,
0.0f, -1000.0f, 0.0f, 0.0f, 1000.0f, 0.0f,
0.0f, 0.0f, -1000.0f, 0.0f, 0.0f, 1000.0f};
-10000.f, 0.0f, 0.0f, 10000.f, 0.0f, 0.0f,
0.0f, -10000.0f, 0.0f, 0.0f, 10000.0f, 0.0f,
0.0f, 0.0f, -10000.0f, 0.0f, 0.0f, 10000.0f};
glGenBuffers(1, coordVbo);

glBindBuffer(GL_ARRAY_BUFFER, coordVbo[0]);
Expand All @@ -183,8 +183,8 @@ void setupVert_plane(std::vector<std::shared_ptr<Wall>> const &walls)
vector<float> normalVectors;
vector<float> locations;
float planeVertexPositions[18] =
{5.0f, -5.0f, 0.0f, 5.0f, 5.0f, 0.0f, -5.0f, -5.0f, 0.0f,
-5.0f, -5.0f, 0.0f, -5.0f, 5.0f, 0.0f, 5.0f, 5.0f, 0.0f};
{1000.0f, -1000.0f, 0.0f, 1000.0f, 1000.0f, 0.0f, -1000.0f, -1000.0f, 0.0f,
-1000.0f, -1000.0f, 0.0f, -1000.0f, 1000.0f, 0.0f, 1000.0f, 1000.0f, 0.0f};
for (auto const &i : walls)
{
locations.push_back(i->loc().x);
Expand Down Expand Up @@ -347,6 +347,7 @@ void draw_sphere(vector<shared_ptr<Ball>> const &balls)
void draw_wall(vector<shared_ptr<Wall>> const &walls)
{
glUseProgram(planeRenderingProgram);
glLineWidth(3.0f);
glLineWidth(1.0f);

//uniform
Expand All @@ -373,6 +374,7 @@ void draw_wall(vector<shared_ptr<Wall>> const &walls)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDrawArraysInstanced(GL_PATCHES, 0, 6, walls.size());
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1.0f);
}

void draw_container(vector<shared_ptr<Container>> const &containers)
Expand Down Expand Up @@ -450,11 +452,11 @@ int main(void)
//string file;
//cin >> file;
//freopen("event_out.txt", "w", stdout);
ifstream ifstrm("testdata.txt");
ifstream ifstrm("E:\\Coding\\data\\walls.txt");

//创建碰撞系统
//ifstrm >> cameraLoc >> lookAt >> rot_v;
cameraLoc = glm::vec3(10, 10, 5);
cameraLoc = glm::vec3(100, 100, 50);
lookAt = glm::vec3(0.0f);
rot_v = 0.05f;
CollisionSystem system(ifstrm);
Expand Down Expand Up @@ -501,7 +503,7 @@ int main(void)
//sumexam = 0;
}//*/

system.run(1.0f/30.0f);
//system.run(1.0f/30.0f);


//if (system.time() > 30)
Expand Down
8 changes: 4 additions & 4 deletions OpenGLProject/tcs_plane.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ layout (vertices = 3) out;
void main(void)
{
if(gl_InvocationID==0){
gl_TessLevelInner[0] = 10.0;
gl_TessLevelOuter[0] = 10.0;
gl_TessLevelOuter[1] = 10.0;
gl_TessLevelOuter[2] = 10.0;
gl_TessLevelInner[0] = 256.0;
gl_TessLevelOuter[0] = 256.0;
gl_TessLevelOuter[1] = 256.0;
gl_TessLevelOuter[2] = 256.0;
}
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}

0 comments on commit c2639e3

Please sign in to comment.