关于
2023年2月,x3cc.com因为程序代码的出错导致网站进不去了,进入将近五个月的空白期,史称
“空白的0.417年”。
而这并不代表x3cc.com从此销声匿迹了。7月12日,x3cc.com终于回归!。
新x3cc.com有新引擎,新功能,更加便于读者阅读文章。
这个版本记住之上,文章质量也会提升。不再是简单的日常作文随笔,更多的是课题研究类文章。另外,新x3cc.com还推出了项目实践栏目,我们接受一切由编程语言开发的网页小游戏呈现在x3cc.com上,敬请期待!
2023年2月,x3cc.com因为程序代码的出错导致网站进不去了,进入将近五个月的空白期,史称
“空白的0.417年”。
而这并不代表x3cc.com从此销声匿迹了。7月12日,x3cc.com终于回归!。
新x3cc.com有新引擎,新功能,更加便于读者阅读文章。
这个版本记住之上,文章质量也会提升。不再是简单的日常作文随笔,更多的是课题研究类文章。另外,新x3cc.com还推出了项目实践栏目,我们接受一切由编程语言开发的网页小游戏呈现在x3cc.com上,敬请期待!
新写的科幻小说:
永日计划
https://czlj.net/forum.php?mod=forumdisplay&fid=47
x3cc.com站点图标史诗级改革,泰酷辣
帅,X的设计很有意思,3感觉有点俗(逃),总体来说很酷
近期,CZLJ服务器服务商更换IP地址,导致70%的地区无法访问,Windows系统解决方法如下:搜索“记事本”——点击“以管理员身份运行”——进入后,打开C:\Windows\System32\drivers\etc\hosts——回车新建一行,输入“154.40.37.129 czlj.net”——Ctrl+S保存后,CZLJ即可再次访问
CZLJ服务器IP问题基本解决,可能是DNS污染,大部分地区恢复访问
......主打个看不懂......
怎么“<"">"里的内容显示不出来啊? :-(
feature
//#define random(x) (rand()%x)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
float PI = 3.14;
//视角控制
float look_x = 0,
look_y = 0,
look_z = 0,
look_x_temp = 0,
look_z_temp = 0;
float screenrate_x, screenrate_y;//鼠标屏幕坐标相对于中心点移动的比例
float r = 10;
float eye_x=0.0,eye_y=0.0,eye_z=0.0;
float RED=0.0,GREEN=0.0,BLUE=0.0;
int flag=0;
int centerpoint_x = WindowWidth / 2,
centerpoint_y = WindowHeight / 2;
//void changeSize(int w,int h)
//{
// glViewport(0,0,w,h);
//}
//控制鼠标位置函数
SetCursorPos(x, y);void mousemove(int x,int y)
{
}
//不按鼠标移动事件
float offsetx = screen_x - centerpoint_x; float offsety = screen_y - centerpoint_y; screenrate_x = offsetx / centerpoint_x * PI;//用于摄像机水平移动 screenrate_y = offsety / centerpoint_y * PI / 2;//用于摄像机上下移动 //水平方向 look_x_temp = r * sin(screenrate_x); look_z_temp = r * cos(screenrate_x);//最后使用时要和相机坐标相加/减 //竖直方向 look_y = r * sin(-screenrate_y); float r_castlenght = abs(r * cos(screenrate_y));//投影在xz面的长度 //根据长度计算真正的look_x,look_z look_x =/*look_x*/+r_castlenght * look_x_temp / r; look_z =/*look_z*/+r_castlenght * look_z_temp / r;void onMouseMovePassive(int screen_x, int screen_y) {
// mousemove(WindowHeight/2,WindowWidth/2);
}
//按下鼠标移动事件
void onMouseDownAndMove(int x, int y) {
}
float step = 0.01;
if(key==' ') eye_y+=1;void keyboardFunc(unsigned char key, int x, int y) {
// if(key==ShiftLeft128||key==ShiftRight128) eye_y-=1;
if (key == 'w') { //朝镜头方向前进look_x,look_z eye_x += look_x_temp * step*2; eye_z -= look_z_temp * step*2; } if (key == 's') { eye_x -= look_x_temp * step*2; eye_z += look_z_temp * step*2; } if (key == 'a') { //左 (x,y)对应(y,-x) //则(look_x,look_z)对应的为(-look_z,look_x) //Z轴取反 eye_x += -look_z_temp * step*2; eye_z -= look_x_temp * step*2; } if (key == 'd') { //右 (x,y)对应(-y,x) //则(look_x,look_z)对应的为(look_z,-look_x) //Z轴取反 eye_x += look_z_temp * step*2; eye_z -= -look_x_temp * step*2; }}
void display1(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0.0,0.6,1.0,0.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(75, 1, 0, 800); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eye_x, eye_y, eye_z, eye_x + look_x, eye_y + look_y, eye_z - look_z, 0, 1, 0);//注意因为相机是面朝z负方向,所以cpos_z - lookz //前面 glBegin(GL_QUADS); glColor3f(0.0,1.0,0.0); glVertex3f(-4.0,-4.0,-4.0); glVertex3f(4.0,-4.0,-4.0); glVertex3f(4.0,4.0,-4.0); glVertex3f(-4.0,4.0,-4.0); glEnd(); //底面 glBegin(GL_QUADS); glColor3f(RED,GREEN,BLUE); glVertex3f(-4.0,-4.0,-4.0); glVertex3f(4.0,-4.0,-4.0); glVertex3f(4.0,-4.0,4.0); glVertex3f(-4.0,-4.0,4.0); //左面 glVertex3f(-4.0,-4.0,4.0); glVertex3f(-4.0,-4.0,-4.0); glVertex3f(-4.0,4.0,-4.0); glVertex3f(-4.0,4.0,4.0); //上面 glVertex3f(-4.0,4.0,-4.0); glVertex3f(4.0,4.0,-4.0); glVertex3f(4.0,4.0,4.0); glVertex3f(-4.0,4.0,4.0); //后面 glVertex3f(-4.0,-4.0,4.0); glVertex3f(4.0,-4.0,4.0); glVertex3f(4.0,4.0,4.0); glVertex3f(-4.0,4.0,4.0); //右面 glVertex3f(4.0,-4.0,4.0); glVertex3f(4.0,-4.0,-4.0); glVertex3f(4.0,4.0,-4.0); glVertex3f(4.0,4.0,4.0); glEnd(); glutSwapBuffers();{
}
void draw_1(void)
Sleep(100); if(RED<1.0) {Sleep(100);RED+=0.1;} else { if(GREEN<1.0) {Sleep(100);GREEN+=0.1;} else{ if(BLUE<1.0) {Sleep(100);BLUE+=0.1;} else{ Sleep(100); RED=0.1; GREEN=0.0; BLUE=0.0; } } } display1();{
}
int main(int argc,char* argv[]){
glutInit(&argc,argv); glutCreateWindow("渲染正方体"); glutInitWindowPosition(480,360); glutInitWindowSize(WindowWidth, WindowHeight); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutPassiveMotionFunc(&onMouseMovePassive); glutMotionFunc(&onMouseDownAndMove); glutDisplayFunc(&display1); glutIdleFunc(&draw_1); glutKeyboardFunc(&keyboardFunc); glutMainLoop(); return 0;}
发送至张师嘉:
好消息,小熊猫C++缺省提供了ege、海龟作图、raylib、freeglut等的自动连接配置。因此,可以直接#include<freeglut.h>和#include<glut.h>
OpenGL基础教程网址:
王小希ww的博客
https://blog.csdn.net/qq_33934427/article/details/127046119?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169668499016800185830861%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=169668499016800185830861&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-127046119-null-null.142^v95^insert_down28v1&utm_term=OpenGL%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B&spm=1018.2226.3001.4187
王小希ww的博客
https://blog.csdn.net/qq_33934427/article/details/127045910?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169668499016800185830861%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=169668499016800185830861&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-2-127045910-null-null.142^v95^insert_down28v1&utm_term=OpenGL%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B&spm=1018.2226.3001.4187
//基于OpenGL制作的第一人称模拟(小熊猫C++可以直接使用
define _CRT_SECURE_NO_WARNINGSdefine WindowWidth 400define WindowHeight 400define WindowTitle "第一人称视角漫游demo"include <GL/glut.h>include <stdio.h>include <stdlib.h>include <math.h>includeusing namespace std;
float PI = 3.14;
//视角控制
float look_x = 0,
look_y = 0,
look_z = 0,
look_x_temp = 0,
look_z_temp = 0;
float screenrate_x, screenrate_y;//鼠标屏幕坐标相对于中心点移动的比例
float r = 10;
//相机位置
float cpos_x = 0,
cpos_y = 2,
cpos_z = 10;
int centerpoint_x = WindowWidth / 2,
centerpoint_y = WindowHeight / 2;
void display(void)
// 清除屏幕 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // 设置视角 glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(75, 1, 1, 30); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(cpos_x, cpos_y, cpos_z, cpos_x + look_x, cpos_y + look_y, cpos_z - look_z, 0, 1, 0);//注意因为相机是面朝z负方向,所以cpos_z - lookz //gluLookAt(cpos_x, cpos_y, cpos_z, 0, 0, 0, 0, 1, 0);//原固定视角 //蓝色地面 glColor3f(0.0, 0.0, 1.0); glBegin(GL_QUADS); glVertex3f(-8.0f, 0.0f, -8.0f); glVertex3f(-8.0f, 0.0f, 8.0f); glVertex3f(8.0f, 0.0f, 8.0f); glVertex3f(8.0f, 0.0f, -8.0f); glEnd(); //红色墙面 glColor3f(1.0, 0.0, 0.0); glBegin(GL_QUADS); glVertex3f(8.0f, 0.0f, -8.0f); glVertex3f(8.0f, 8.0f, -8.0f); glVertex3f(-8.0f, 8.0f, -8.0f); glVertex3f(-8.0f, 0.0f, -8.0f); glEnd(); glutSwapBuffers();{
}
void myIdle(void)
display();{
}
//不按鼠标移动事件
float offsetx = screen_x - centerpoint_x; float offsety = screen_y - centerpoint_y; screenrate_x = offsetx / centerpoint_x * PI;//用于摄像机水平移动 screenrate_y = offsety / centerpoint_y * PI / 2;//用于摄像机上下移动 //水平方向 look_x_temp = r * sin(screenrate_x); look_z_temp = r * cos(screenrate_x);//最后使用时要和相机坐标相加/减 //竖直方向 look_y = r * sin(-screenrate_y); float r_castlenght = abs(r * cos(screenrate_y));//投影在xz面的长度 //根据长度计算真正的look_x,look_z look_x = r_castlenght * look_x_temp / r; look_z = r_castlenght * look_z_temp / r;void onMouseMovePassive(int screen_x, int screen_y) {
}
//按下鼠标移动事件
void onMouseDownAndMove(int x, int y) {
}
float step = 0.01;
if (key == 'w') { //朝镜头方向前进look_x,look_z cpos_x += look_x_temp * step; cpos_z -= look_z_temp * step; } if (key == 's') { cpos_x -= look_x_temp * step; cpos_z += look_z_temp * step; } if (key == 'a') { //左 (x,y)对应(y,-x) //则(look_x,look_z)对应的为(-look_z,look_x) //Z轴取反 cpos_x += -look_z_temp * step; cpos_z -= look_x_temp * step; } if (key == 'd') { //右 (x,y)对应(-y,x) //则(look_x,look_z)对应的为(look_z,-look_x) //Z轴取反 cpos_x += look_z_temp * step; cpos_z -= -look_x_temp * step; }void keyboardFunc(unsigned char key, int x, int y) {
}
int main(int argc, char* argv[])
glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100, 100); glutInitWindowSize(WindowWidth, WindowHeight); glutCreateWindow(WindowTitle); glutPassiveMotionFunc(onMouseMovePassive); glutMotionFunc(onMouseDownAndMove); glutKeyboardFunc(keyboardFunc); glutDisplayFunc(&display); glutIdleFunc(&myIdle); glutMainLoop(); return 0;{
}
这6个include全是空的,咋回事
bu shi o
@张师嘉 这位倪兄是OIer吗?
很高兴成为你的同学
真厉害啊张同学,你的PixelWorld我试过了,挺不错的
我希望PixelWorld不仅能够导出Pix文件,还能到处其他格式的文件
如:.png .jpg .bmp 等等
https://xege.org/manual/index.htm
EGE教程大全
谢谢-----同学倪旌瑞
西外同学相聚真是非常高兴啊,可惜我班上今年考CSPj的只有两个,另一个看上去可能连你谷都没听说过。。。<(_ _)>
我咋不知道
初中欸,还有这啥时候的事了。。。