本文整理汇总了C++中Square::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Square::SetColor方法的具体用法?C++ Square::SetColor怎么用?C++ Square::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Square
的用法示例。
在下文中一共展示了Square::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
InitGlfw initGlfw;
ShaderLoader shaderLoader;
TextureLoader textureLoader;
TextRenderer textRenderer;
// Init
initGlfw.Init();
textRenderer.Init();
glfwSetKeyCallback(initGlfw.window, KeyCallback);
glfwSetMouseButtonCallback(initGlfw.window, MouseButtonCallback);
glfwSetCursorPosCallback(initGlfw.window, MouseMoveCallback);
// Shader loading
GLuint defaultShaderProgram;
GLuint textShaderProgram;
GLuint simpleShaderProgram;
defaultShaderProgram = shaderLoader.CreateProgram("Shaders\\vertex_shader.glsl", "Shaders\\fragment_shader.glsl");
textShaderProgram = shaderLoader.CreateProgram("Shaders\\text_vs.glsl", "Shaders\\text_fs.glsl");
simpleShaderProgram = shaderLoader.CreateProgram("Shaders\\simple_vertex_shader.glsl", "Shaders\\simple_fragment_shader.glsl");
// Load texture
GLuint texture = textureLoader.LoadRGB("Images\\container.jpg");
GLuint blankTexture = textureLoader.LoadBlank();
cout << "Blank texture status: " << blankTexture << endl;
// Define camera component vectors
float wallDistanceMargin = 0.2f;
float currentX;
float currentZ;
glm::vec3 cameraPos = glm::vec3(0.0f, -0.5f, 6.0f);
glm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);
glm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);
float yaw = -90.0f;
glm::vec3 front(cos(glm::radians(yaw)), 0.0f, sin(glm::radians(yaw)));
// Define model and view matrices and get shader locations
GLuint modelLocation = glGetUniformLocation(defaultShaderProgram, "model");
GLuint viewLocation = glGetUniformLocation(defaultShaderProgram, "view");
GLuint projectionLocation = glGetUniformLocation(defaultShaderProgram, "projection");
double currentTime = glfwGetTime();
double delta;
glm::mat4 view;
glm::mat4 proj1;
glm::mat4 idm = glm::mat4();
// Hard-coded virtual environment
Square backWall;
Square leftWall;
Square rightWall;
Square floorSquare;
Square frontWall;
Square rewardZone;
float corridorDepth = 10.0f;
float corridorWidth = 3.0f;
float wallHeight = 2.0f;
float rewardZoneDepth = 2.0f;
float rewardZonePosition = -3.0f;
float rewardZoneLowZ = rewardZonePosition - rewardZoneDepth;
float rewardZoneHighZ = rewardZonePosition + rewardZoneDepth;
bool inRewardZone = false;
backWall.SetColor(0.5f, 0.5f, 0.9f);
backWall.SetScaling(corridorWidth, wallHeight);
backWall.SetPosition(0.0f, wallHeight/2, -corridorDepth);
frontWall.SetColor(0.5f, 0.5f, 0.9f);
frontWall.SetScaling(corridorWidth, wallHeight);
frontWall.SetPosition(0.0f, wallHeight / 2.0f, corridorDepth);
leftWall.SetColor(0.5f, 0.9f, 0.5f);
leftWall.SetScaling(corridorDepth, wallHeight);
leftWall.SetRotation(0.0f, 90.0f, 0.0f);
leftWall.SetPosition(-corridorWidth, wallHeight/2, 0.0f);
rightWall.SetColor(0.5f, 0.9f, 0.5f);
rightWall.SetScaling(corridorDepth, wallHeight);
rightWall.SetRotation(0.0f, 90.0f, 0.0f);
rightWall.SetPosition(corridorWidth,wallHeight/2, 0.0f);
floorSquare.SetColor(0.1f, 0.1f, 0.1f);
floorSquare.SetScaling(corridorWidth, corridorDepth);
floorSquare.SetRotation(-90.0f, 0.0f, 0.0f);
floorSquare.SetPosition(0.0f, -wallHeight/2.0f, 0.0f);
rewardZone.SetColor(0.2f, 0.9f, 0.2f);
rewardZone.SetScaling(corridorWidth, rewardZoneDepth);
rewardZone.SetRotation(-90.0f, 0.0f, 0.0f);
rewardZone.SetPosition(0.0f, -wallHeight / 2.0f + 0.01f, rewardZonePosition);
proj1 = glm::perspective(45.0f, (float)2.0f*initGlfw.windowInfo.width / initGlfw.windowInfo.height, 0.1f, 100.0f);
glEnable(GL_DEPTH_TEST);
//.........这里部分代码省略.........