当前位置: 首页 > news >正文

第一个3D程序!

 运行效果

CPP

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <soil2/SOIL2.h>#define PI 3.14159f#define numVAOs 1
#define numVBOs 128#define SPEED 0.1f
#define ANGLE 0.01fusing namespace std;GLuint rendering_program;
GLuint vao[numVAOs];
GLuint vbo[numVBOs];
GLuint vbo_count = 0;
GLuint mvloc, ploc, nloc;
GLuint clr_loc;
GLuint global_amb_loc, dirlight_amb_loc, dirlight_dif_loc, dirlight_dir_loc;int HEIGHT = 724, WIDTH = 1024;
float aspect = (float)WIDTH / (float)HEIGHT;glm::vec4 GlobalAmbient = { 0.6f, 0.6f, 0.6f, 1.0f };	//全局环境光
glm::vec4 DirLightAmbient = { 0.2f, 0.2f, 0.2f, 1.0f };	//定向光:环境特征
glm::vec4 DirLightDiffuse = { 0.5f, 0.5f, 0.5f, 1.0f };
glm::vec3 DirLightDirection = { -1.0f, -1.732f, 0.0f };glm::mat4 tmat;											//平移
glm::mat4 rmat;											//旋转
glm::mat4 vmat;											//t_mat * r_mat
glm::mat4 pmat;											//透视
glm::mat4 mvmat;
glm::mat4 invmat;										//mv矩阵的逆struct Camera {float x, y, z;float theta, fine;
}camera;struct Tetrahedron {GLuint vbo_index[2] = { 0 };glm::vec3 position = { 0.0f, 0.0f, 0.0f };float vertex_positions[36] = {0.0f, -0.408f, 1.155f, -1.0f, -0.408f, -0.577f, 1.0f, -0.408f, -0.577f,0.0f, -0.408f, 1.155f, 0.0f, 1.225f, 0.0f, -1.0f, -0.408f, -0.577f,0.0f, -0.408f, 1.155f, 1.0f, -0.408f, -0.577f, 0.0f, 1.225f, 0.0f,-1.0f, -0.408f, -0.577f, 0.0f, 1.225f, 0.0f, 1.0f, -0.408f, -0.577f};float vertex_normal[36] = {0.0f, 1.225f, 0.0f, 0.0f, 1.225f, 0.0f, 0.0f, 1.225f, 0.0f,1.0f, -0.408f, -0.577f, 1.0f, -0.408f, -0.577f, 1.0f, -0.408f, -0.577f,-1.0f, -0.408f, -0.577f, -1.0f, -0.408f, -0.577f, -1.0f, -0.408f, -0.577f,0.0f, -0.408f, 1.155f, 0.0f, -0.408f, 1.155f, 0.0f, -0.408f, 1.155f};void init(float x, float y, float z) {vbo_index[0] = vbo_count++;vbo_index[1] = vbo_count++;position = { x, y, z };glBindBuffer(GL_ARRAY_BUFFER, vbo[vbo_index[0]]);glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_positions), vertex_positions, GL_STATIC_DRAW);glBindBuffer(GL_ARRAY_BUFFER, vbo[vbo_index[1]]);glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_normal), vertex_normal, GL_STATIC_DRAW);}
}tetrahedron;
struct Plane {GLuint vbo_index[2] = { 0 };glm::vec3 position = { 0.0f, 0.0f, 0.0f };float vertex_positions[18] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};float vertex_normal[18] = {0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f};void init(float x, float y, float z) {vbo_index[0] = vbo_count++;vbo_index[1] = vbo_count++;position = { x, y, z };glBindBuffer(GL_ARRAY_BUFFER, vbo[vbo_index[0]]);glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_positions), vertex_positions, GL_STATIC_DRAW);glBindBuffer(GL_ARRAY_BUFFER, vbo[vbo_index[1]]);glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_normal), vertex_normal, GL_STATIC_DRAW);}
}plane;string ReadShaderSource(const char* file_path) {string content;string line = "";ifstream file_stream(file_path, ios::in);while (!file_stream.eof()) {getline(file_stream, line);content.append(line + "\n");}file_stream.close();return content;
}
void PrintShaderLog(GLuint shader) {int len = 0;int ch_writtn = 0;char* log;glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);if (len > 0) {log = (char*)malloc(len);glGetShaderInfoLog(shader, len, &ch_writtn, log);cout << "Shader Info Log:" << log << endl;free(log);}
}
void PrintProgramLog(GLuint program) {int len = 0;int ch_writtn = 0;char* log;glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len);if (len > 0) {log = (char*)malloc(len);glGetProgramInfoLog(program, len, &ch_writtn, log);cout << "Program Info Log:" << log << endl;free(log);}
}
bool CheckOpenGLError() {bool found_error = false;int glerr = glGetError();while (glerr != GL_NO_ERROR) {cout << "GL ERROR:" << glerr << endl;found_error = true;glerr = glGetError();}return found_error;
}
GLuint CreateShaderProgram() {GLuint vshader = glCreateShader(GL_VERTEX_SHADER);GLuint fshader = glCreateShader(GL_FRAGMENT_SHADER);GLint vert_compiled;GLint frag_compiled;GLint linked;string vert_shader_string = ReadShaderSource("vert_shader.glsl");string frag_shader_string = ReadShaderSource("frag_shader.glsl");const char* vert_shader_source = vert_shader_string.c_str();const char* frag_shader_source = frag_shader_string.c_str();glShaderSource(vshader, 1, &vert_shader_source, NULL);glShaderSource(fshader, 1, &frag_shader_source, NULL);glCompileShader(vshader);CheckOpenGLError();glGetShaderiv(vshader, GL_COMPILE_STATUS, &vert_compiled);if (vert_compiled != 1) {cout << "vertex compilation failed" << endl;PrintShaderLog(vshader);}glCompileShader(fshader);CheckOpenGLError();glGetShaderiv(fshader, GL_COMPILE_STATUS, &frag_compiled);if (frag_compiled != 1) {cout << "fragment compilation failed" << endl;PrintShaderLog(fshader);}GLuint program = glCreateProgram();glAttachShader(program, vshader);glAttachShader(program, fshader);glLinkProgram(program);CheckOpenGLError();glGetProgramiv(program, GL_LINK_STATUS, &linked);if (linked != 1) {cout << "linking failed" << endl;PrintProgramLog(program);}return program;
}
GLuint LoadTexture(const char* ImagePath) {GLuint textureID;textureID = SOIL_load_OGL_texture(ImagePath, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);if (textureID == 0) cout << "could not find texture file:" << ImagePath << endl;return textureID;
}
void init(GLFWwindow* window) {vmat = glm::mat4(1.0f);rmat = glm::mat4(1.0f);pmat = glm::perspective(1.3f, aspect, 0.1f, 1000.0f);rendering_program = CreateShaderProgram();glGenVertexArrays(numVAOs, vao);glBindVertexArray(vao[0]);glGenBuffers(numVBOs, vbo);tetrahedron.init(4.0f, 4.0f, 4.0f);plane.init(0.0f, 0.0f, 0.0f);
}
void MoveCamera(GLFWwindow* window) {bool translate = false;bool rotato = false;if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) {camera.x -= (float)sin(camera.theta) * SPEED;camera.z -= (float)cos(camera.theta) * SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) {camera.x += (float)sin(camera.theta) * SPEED;camera.z += (float)cos(camera.theta) * SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) {camera.x -= (float)cos(camera.theta) * SPEED;camera.z += (float)sin(camera.theta) * SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) {camera.x += (float)cos(camera.theta) * SPEED;camera.z -= (float)sin(camera.theta) * SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS) {camera.y += SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) {camera.y -= SPEED;translate = true;}if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS) {if (camera.fine < PI / 2.0) {camera.fine += ANGLE;rotato = true;}}if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS) {if (camera.fine > -PI / 2.0) {camera.fine -= ANGLE;rotato = true;}}if (glfwGetKey(window, GLFW_KEY_LEFT) == GLFW_PRESS) {camera.theta += ANGLE;rotato = true;}if (glfwGetKey(window, GLFW_KEY_RIGHT) == GLFW_PRESS) {camera.theta -= ANGLE;rotato = true;}if (translate) tmat = glm::translate(glm::mat4(1.0f), glm::vec3(-camera.x, -camera.y, -camera.z));if (rotato) rmat = {{ cos(camera.theta)  , sin(camera.fine) * sin(camera.theta), cos(camera.fine) * sin(camera.theta), 0.0f },{ 0.0f				 , cos(camera.fine)					 , -sin(camera.fine)				   , 0.0f },{ -sin(camera.theta) , sin(camera.fine) * cos(camera.theta), cos(camera.fine) * cos(camera.theta), 0.0f },{ 0.0f				 , 0.0f								 , 0.0f								   , 1.0f }};if (translate || rotato) vmat = rmat * tmat;
}
void WindowReshapeCallback(GLFWwindow* window, int new_width, int new_height) {WIDTH = new_width;HEIGHT = new_height;aspect = (float)WIDTH / (float)HEIGHT;pmat = glm::perspective(1.3f, aspect, 0.1f, 1000.0f);glViewport(0, 0, WIDTH, HEIGHT);
}
void InstallLight() {global_amb_loc = glGetUniformLocation(rendering_program, "GlobalAmbient");dirlight_amb_loc = glGetUniformLocation(rendering_program, "DirLightAmbient");dirlight_dif_loc = glGetUniformLocation(rendering_program, "DirLightDiffuse");dirlight_dir_loc = glGetUniformLocation(rendering_program, "DirLightDirection");glProgramUniform4fv(rendering_program, global_amb_loc, 1, glm::value_ptr(GlobalAmbient));glProgramUniform4fv(rendering_program, dirlight_amb_loc, 1, glm::value_ptr(DirLightAmbient));glProgramUniform4fv(rendering_program, dirlight_dif_loc, 1, glm::value_ptr(DirLightDiffuse));glProgramUniform3fv(rendering_program, dirlight_dir_loc, 1, glm::value_ptr(DirLightDirection));
}
void display(GLFWwindow* window, double curretTime) {glClear(GL_DEPTH_BUFFER_BIT);glClear(GL_COLOR_BUFFER_BIT);glUseProgram(rendering_program);InstallLight();mvloc = glGetUniformLocation(rendering_program, "mvmat");ploc = glGetUniformLocation(rendering_program, "pmat");nloc = glGetUniformLocation(rendering_program, "nmat");clr_loc = glGetUniformLocation(rendering_program, "texture_color");glDisable(GL_CULL_FACE);for (int x = -32; x < 32; x++)for (int z = -32; z < 32; z++) {glm::vec4 texture_color(0.0f, 0.0f, 1.0f, 1.0f);glm::mat4 mmat_p = glm::translate(glm::mat4(1.0f), glm::vec3((float)x, 0.0f, (float)z));if ((x + z) & 1) texture_color = { 0.0f, 1.0f, 0.0f, 1.0f };mvmat = vmat * mmat_p;invmat = glm::transpose(glm::inverse(mvmat));glUniformMatrix4fv(mvloc, 1, GL_FALSE, glm::value_ptr(mvmat));glUniformMatrix4fv(ploc, 1, GL_FALSE, glm::value_ptr(pmat));glUniformMatrix4fv(nloc, 1, GL_FALSE, glm::value_ptr(invmat));glUniform4fv(clr_loc, 1, glm::value_ptr(texture_color));glBindBuffer(GL_ARRAY_BUFFER, vbo[plane.vbo_index[0]]);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);glEnableVertexAttribArray(0);glBindBuffer(GL_ARRAY_BUFFER, vbo[plane.vbo_index[1]]);glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);glEnableVertexAttribArray(1);glEnable(GL_DEPTH_TEST);glDepthFunc(GL_LEQUAL);glDrawArrays(GL_TRIANGLES, 0, 6);}glEnable(GL_CULL_FACE);glm::mat4 mmat_t = glm::translate(glm::mat4(1.0f), tetrahedron.position);mvmat = vmat * mmat_t;invmat = glm::transpose(glm::inverse(mvmat));glUniformMatrix4fv(mvloc, 1, GL_FALSE, glm::value_ptr(mvmat));glUniformMatrix4fv(ploc, 1, GL_FALSE, glm::value_ptr(pmat));glUniformMatrix4fv(nloc, 1, GL_FALSE, glm::value_ptr(invmat));glUniform4fv(clr_loc, 1, glm::value_ptr(glm::vec4(1.0f, 0.0f, 0.0f, 1.0f)));glBindBuffer(GL_ARRAY_BUFFER, vbo[tetrahedron.vbo_index[0]]);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);glEnableVertexAttribArray(0);glBindBuffer(GL_ARRAY_BUFFER, vbo[tetrahedron.vbo_index[1]]);glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);glEnableVertexAttribArray(1);glEnable(GL_DEPTH_TEST);glDepthFunc(GL_LEQUAL);glDrawArrays(GL_TRIANGLES, 0, 12);
}
int main() {if (!glfwInit()) { exit(EXIT_FAILURE); }glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "HelloWorld", NULL, NULL);glfwMakeContextCurrent(window);if (glewInit() != GLEW_OK) { exit(EXIT_FAILURE); }glfwSwapInterval(1);glfwSetWindowSizeCallback(window, WindowReshapeCallback);init(window);while (!glfwWindowShouldClose(window)) {MoveCamera(window);display(window, glfwGetTime());glfwSwapBuffers(window);glfwPollEvents();}glfwDestroyWindow(window);glfwTerminate();exit(EXIT_SUCCESS);
}

顶点着色器

#version 430layout (location=0) in vec3 position;
layout (location=1) in vec3 normal;out vec3 varying_normal;
out vec3 varying_direction;uniform mat4 mvmat;
uniform mat4 pmat;
uniform mat4 nmat;
uniform vec4 texture_color;
h
uniform vec4 GlobalAmbient;
uniform vec4 DirLightAmbient;
uniform vec4 DirLightDiffuse;
uniform vec3 DirLightDirection;void main(void) {varying_normal = (nmat * vec4(normal, 1.0)).xyz;varying_direction = (nmat * vec4(DirLightDirection, 1.0)).xyz;gl_Position = pmat * mvmat * vec4(position, 1.0);
}

片段着色器

#version 430in vec3 varying_normal;
in vec3 varying_direction;out vec4 color;uniform mat4 mvmat;
uniform mat4 pmat;
uniform mat4 nmat;
uniform vec4 texture_color;uniform vec4 GlobalAmbient;
uniform vec4 DirLightAmbient;
uniform vec4 DirLightDiffuse;
uniform vec3 DirLightDirection;void main(void) {vec3 L = normalize(varying_direction);vec3 N = normalize(varying_normal);float cos_theta = dot(L, N);vec3 ambient = GlobalAmbient.xyz * texture_color.xyz + DirLightAmbient.xyz * texture_color.xyz;vec3 diffuse = texture_color.xyz * DirLightDiffuse.xyz * max(cos_theta, 0.0);color = vec4(ambient + diffuse, 1.0);
}

相关文章:

第一个3D程序!

运行效果 CPP #include <iostream> #include <fstream> #include <string> #include <cmath>#include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/…...

Hive:内部表和外部表,内外转换

内部表和外部表 内部表示例 给表添加数据 外部表示例 给表添加数据 外部表示例 用location指定表目录位置,那么表的位置在实际指定的位置,但是可以被映射 外部表和内部表的区别 删除表后使用show tables in shao; 已经没有被删除的表,说明元数据已经被删除(mysql里面存放),但是…...

2024收尾工作

目录 开场白 栈与队列 LeetCode232. 用栈实现队列 LeetCode225. 用队列实现栈 LeetCode102. 二叉树的层序遍历 LeetCode103. 二叉树的锯齿形层序遍历 堆&#xff08;优先级队列&#xff09; 堆排序 LeetCode215. 数组中的第 k 个最大元素 总结 开场白 今天是除夕&…...

能说说MyBatis的工作原理吗?

大家好&#xff0c;我是锋哥。今天分享关于【Redis为什么这么快?】面试题。希望对大家有帮助&#xff1b; 能说说MyBatis的工作原理吗&#xff1f; MyBatis 是一款流行的持久层框架&#xff0c;它通过简化数据库操作&#xff0c;帮助开发者更高效地与数据库进行交互。MyBatis…...

简单的SQL语句的快速复习

语法的执行顺序 select 4 字段列表 from 1 表名列表 where 2 条件列表 group by 3 分组前过滤 having 分组后过滤 order by 5 排序字段列表 limit 6 分页参数 聚合函数 count 统计数量 max 最大值 min 最小值 avg 平均 sum 总和 分组查询使…...

Spring MVC 综合案例

目录 一. 加法计算器 1. 准备工作 2. 约定前后端交互接口 需求分析 接口定义 3. 服务器端代码 4. 运行测试 二. 用户登录 1. 准备工作 2. 约定前后端交互接口 需求分析 接口定义 (1) 登录界面接口 (2) 首页接口 3. 服务器端代码 4. 运行测试 三. 留言板 1. 准备…...

Spring Boot多环境配置实践指南

在开发Spring Boot应用时&#xff0c;我们常常需要根据不同的运行环境&#xff08;如开发环境、测试环境和生产环境&#xff09;来配置不同的参数。Spring Boot提供了非常灵活的多环境配置机制&#xff0c;通过使用profile-specific properties文件&#xff0c;我们可以轻松地管…...

微信小程序中实现进入页面时数字跳动效果(自定义animate-numbers组件)

微信小程序中实现进入页面时数字跳动效果 1. 组件定义,新建animate-numbers组件1.1 index.js1.2 wxml1.3 wxss 2. 使用组件 1. 组件定义,新建animate-numbers组件 1.1 index.js // components/animate-numbers/index.js Component({properties: {number: {type: Number,value…...

【huawei】云计算的备份和容灾

目录 1 备份和容灾 2 灾备的作用&#xff1f; ① 备份的作用 ② 容灾的作用 3 灾备的衡量指标 ① 数据恢复时间点&#xff08;RPO&#xff0c;Recoyery Point Objective&#xff09; ② 应用恢复时间&#xff08;RTO&#xff0c;Recoyery Time Objective&#xff09; 4…...

Vue.js组件开发-实现下载时暂停恢复下载

在 Vue 中实现下载时暂停和恢复功能&#xff0c;通常可以借助 XMLHttpRequest 对象来控制下载过程。XMLHttpRequest 允许在下载过程中暂停和继续请求。 实现步骤 创建 Vue 组件&#xff1a;创建一个 Vue 组件&#xff0c;包含下载、暂停和恢复按钮。初始化 XMLHttpRequest 对…...

TCP是怎么判断丢包的?

丢包在复杂的网络环境中&#xff0c;是一种常见的现象。 TCP&#xff08;传输控制协议&#xff09;作为一种可靠传输协议&#xff0c;内置了多种机制来检测和处理丢包现象&#xff0c;从而保证数据的完整性和传输的可靠性。本文将介绍TCP判断丢包的原理和机制。 一、TCP可靠传…...

python爬虫入门(一) - requests库与re库,一个简单的爬虫程序

目录 web请求与requests库 1. web请求 1.1 客户端渲染与服务端渲染 1.2 抓包 1.3 HTTP状态代码 2. requests库 2.1 requests模块的下载 2.2 发送请求头与请求参数 2.3 GET请求与POST请求 GET请求的例子&#xff1a; POST请求的例子&#xff1a; 3. 案例&#xff1a;…...

2025年数学建模美赛 A题分析(3)楼梯使用方向偏好模型

2025年数学建模美赛 A题分析&#xff08;1&#xff09;Testing Time: The Constant Wear On Stairs 2025年数学建模美赛 A题分析&#xff08;2&#xff09;楼梯磨损分析模型 2025年数学建模美赛 A题分析&#xff08;3&#xff09;楼梯使用方向偏好模型 2025年数学建模美赛 A题分…...

复古壁纸中棕色系和米色系哪个更受欢迎?

根据最新的搜索结果&#xff0c;我们可以看到棕色系和米色系在复古壁纸设计中都非常受欢迎。以下是对这两种颜色系受欢迎程度的分析&#xff1a; 棕色系 受欢迎程度&#xff1a;棕色系在复古壁纸中非常受欢迎&#xff0c;因为它能够营造出温暖、质朴和自然的氛围。棕色系的壁纸…...

编译安装PaddleClas@openKylin(失败,安装好后报错缺scikit-learn)

编译安装 前置需求&#xff1a; 手工安装swig和faiss-cpu pip install swig pip install faiss-cpu 小技巧&#xff0c;pip编译安装的时候&#xff0c;可以加上--jobs64来多核编译。 注意先升级pip版本&#xff1a;pip install pip -U pip3 install faiss-cpu --config-s…...

t113_can增加驱动

1 基于太极派的SDK添加 //设备树添加can0: can2504000 {compatible "allwinner,sun20i-d1-can";reg <0x0 0x02504000 0x0 0x400>;interrupts <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;clocks <&ccu CLK_BUS_CAN0>;resets <&ccu RST_BUS_…...

达梦数据库建用户,键库脚本

-- 1.创建表空间 CREATE TABLESPACE "表空间名称" DATAFILE /dmdata/data/DAMENG/表空间名称.DBF SIZE 512 AUTOEXTEND ON NEXT 512 MAXSIZE UNLIMITED; -- 2.创建用户 CREATE USER "表空间名称" IDENTIFIED BY "表空间名称" HASH WITH SHA512 S…...

上海亚商投顾:沪指冲高回落 大金融板块全天强势 上海亚商投

上海亚商投顾前言&#xff1a;无惧大盘涨跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 一&#xff0e;市场情绪 市场全天冲高回落&#xff0c;深成指、创业板指午后翻绿。大金融板块全天强势&#xff0c;天茂集团…...

MySQL 的索引类型【图文并茂】

基本分类 文本生成MindMap:https://app.pollyoyo.com/planttext <style> mindmapDiagram {node {BackgroundColor yellow}:depth(0) {BackGroundColor SkyBlue}:depth(1) {BackGroundColor lightGreen} } </style> * MySQL 索引** 数据结构角度 *** B树索引*** 哈…...

天聚地合:引领API数据流通服务,助力数字经济发展

天聚地合&#xff1a;引领API数据流通服务,助力数字经济发展 爱企猫01月24日消息&#xff1a;天聚地合&#xff08;苏州&#xff09;科技股份有限公司,成立于2010年,总部位于苏州,是一家综合性API数据流通服务商。公司旗下品牌‘聚合数据’已开发超过790个API,服务百万企业级客…...

JavaSec-RCE

简介 RCE(Remote Code Execution)&#xff0c;可以分为:命令注入(Command Injection)、代码注入(Code Injection) 代码注入 1.漏洞场景&#xff1a;Groovy代码注入 Groovy是一种基于JVM的动态语言&#xff0c;语法简洁&#xff0c;支持闭包、动态类型和Java互操作性&#xff0c…...

进程地址空间(比特课总结)

一、进程地址空间 1. 环境变量 1 &#xff09;⽤户级环境变量与系统级环境变量 全局属性&#xff1a;环境变量具有全局属性&#xff0c;会被⼦进程继承。例如当bash启动⼦进程时&#xff0c;环 境变量会⾃动传递给⼦进程。 本地变量限制&#xff1a;本地变量只在当前进程(ba…...

DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径

目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...

centos 7 部署awstats 网站访问检测

一、基础环境准备&#xff08;两种安装方式都要做&#xff09; bash # 安装必要依赖 yum install -y httpd perl mod_perl perl-Time-HiRes perl-DateTime systemctl enable httpd # 设置 Apache 开机自启 systemctl start httpd # 启动 Apache二、安装 AWStats&#xff0…...

SpringBoot+uniapp 的 Champion 俱乐部微信小程序设计与实现,论文初版实现

摘要 本论文旨在设计并实现基于 SpringBoot 和 uniapp 的 Champion 俱乐部微信小程序&#xff0c;以满足俱乐部线上活动推广、会员管理、社交互动等需求。通过 SpringBoot 搭建后端服务&#xff0c;提供稳定高效的数据处理与业务逻辑支持&#xff1b;利用 uniapp 实现跨平台前…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

Spring AI 入门:Java 开发者的生成式 AI 实践之路

一、Spring AI 简介 在人工智能技术快速迭代的今天&#xff0c;Spring AI 作为 Spring 生态系统的新生力量&#xff0c;正在成为 Java 开发者拥抱生成式 AI 的最佳选择。该框架通过模块化设计实现了与主流 AI 服务&#xff08;如 OpenAI、Anthropic&#xff09;的无缝对接&…...

【HTTP三个基础问题】

面试官您好&#xff01;HTTP是超文本传输协议&#xff0c;是互联网上客户端和服务器之间传输超文本数据&#xff08;比如文字、图片、音频、视频等&#xff09;的核心协议&#xff0c;当前互联网应用最广泛的版本是HTTP1.1&#xff0c;它基于经典的C/S模型&#xff0c;也就是客…...

VM虚拟机网络配置(ubuntu24桥接模式):配置静态IP

编辑-虚拟网络编辑器-更改设置 选择桥接模式&#xff0c;然后找到相应的网卡&#xff08;可以查看自己本机的网络连接&#xff09; windows连接的网络点击查看属性 编辑虚拟机设置更改网络配置&#xff0c;选择刚才配置的桥接模式 静态ip设置&#xff1a; 我用的ubuntu24桌…...

C++_哈希表

本篇文章是对C学习的哈希表部分的学习分享 相信一定会对你有所帮助~ 那咱们废话不多说&#xff0c;直接开始吧&#xff01; 一、基础概念 1. 哈希核心思想&#xff1a; 哈希函数的作用&#xff1a;通过此函数建立一个Key与存储位置之间的映射关系。理想目标&#xff1a;实现…...