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

阿里巴巴上做网站抖音seo优化软件

阿里巴巴上做网站,抖音seo优化软件,推广的十种方式,网站个性化设计文章目录 前言一、3d 立方体 model 属性相关文件1. cube.obj2. cube.Mtl3. 纹理图片 cordeBouee4.jpg二、代码实例1. 依赖库和头文件1.1 assimp1.2 stb_image.h2. egl_wayland_obj_cube.cpp3. Matrix.h 和 Matrix.cpp4. xdg-shell-client-protocol.h 和 xdg-shell-protocol.c5.…

文章目录

  • 前言
  • 一、3d 立方体 model 属性相关文件
    • 1. cube.obj
    • 2. cube.Mtl
    • 3. 纹理图片 cordeBouee4.jpg
  • 二、代码实例
    • 1. 依赖库和头文件
      • 1.1 assimp
      • 1.2 stb_image.h
    • 2. egl_wayland_obj_cube.cpp
    • 3. Matrix.h 和 Matrix.cpp
    • 4. xdg-shell-client-protocol.h 和 xdg-shell-protocol.c
    • 5. 编译
    • 6. 运行
  • 总结
  • 参考资料


前言

本文主要介绍opengles 如何使用 第三方库Assimp(基于C++) 加载一个最简单的带纹理 的3d 立方体model,3d 立方体 model 信息存储在 cube.obj 中,纹理图片信息存储在cube.Mtl 材质文件中,主要是介绍如何使用Assimp 解析Mtl 文件。
软硬件环境:
硬件:PC
软件:ubuntu22.04 egl1.4 weston9.0 opengles3.0 libassimp.so.5.2.0


一、3d 立方体 model 属性相关文件

.obj文件是一种常见的三维模型文件格式,它包含了描述三维模型的顶点、法线、纹理坐标和面信息等,通常,.obj文件会搭配使用.mtl文件(材质文件)来定义模型的材质属性。

1. cube.obj

本文的例子由于没有使用光照相关的属性,因此,cube.obj 中可以没有法线相关的信息
cube.obj 内容如下:

# 3D Cube with texture coordinatesmtllib cube.Mtl
usemtl cubeMaterial# 顶点坐标
v -1.0 -1.0 1.0
v -1.0 1.0 1.0
v 1.0 1.0 1.0
v 1.0 -1.0 1.0
v -1.0 -1.0 -1.0
v -1.0 1.0 -1.0
v 1.0 1.0 -1.0
v 1.0 -1.0 -1.0# 纹理坐标
vt 0.0 0.0
vt 0.0 1.0
vt 1.0 1.0
vt 1.0 0.0# 面
f 1/1 2/2 3/3
f 1/1 3/3 4/4
f 4/1 3/2 7/3
f 4/1 7/3 8/4
f 8/2 7/1 6/4
f 8/2 6/4 5/3
f 5/3 6/4 2/1
f 5/3 2/1 1/2
f 2/2 6/3 7/4
f 2/2 7/4 3/1
f 5/4 1/1 4/2
f 5/4 4/2 8/3

2. cube.Mtl

本文的例子由于没有使用光照相关的属性,因此,cube.Mtl 中可以没有材质光照相关的信息
cube.Mtl 信息如下:

newmtl cubeMaterial
map_Kd cordeBouee4.jpg

3. 纹理图片 cordeBouee4.jpg

cordeBouee4.jpg

二、代码实例

1. 依赖库和头文件

1.1 assimp

本文是通过使用assimp 来解析3d model 相关的文件,因此需要在 ubuntu 上安装 libassimp.so 库, 安装命令可以查看前面的文章《wayland(xdg_wm_base) + egl + opengles 使用 Assimp 加载3D model 最简实例(十四)》

1.2 stb_image.h

使用 stb_image.h 中相关的接口加载.jpg格式的纹理图片,如何获取 stb_image.h 头文件,可以查看之前的文章《wayland(xdg_wm_base) + egl + opengles 渲染使用纹理贴图的旋转 3D 立方体实例(十三)》

2. egl_wayland_obj_cube.cpp

egl_wayland_obj_cube.cpp 代码如下(示例):

#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-egl.h>
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>#include "Matrix.h"
#include "xdg-shell-client-protocol.h"#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
// 使用 Assimp 加载模型文件
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>#define WIDTH 800
#define HEIGHT 600struct wl_display *display = NULL;
struct wl_compositor *compositor = NULL;
struct xdg_wm_base *wm_base = NULL;
struct wl_registry *registry = NULL;//opengles global varGLuint projectionLocation;
GLuint modelLocation;
GLuint viewLocation;
GLuint simpleCubeProgram;
GLuint samplerLocation;
GLuint textureId;aiMesh *mesh;
aiMaterial *material;
GLfloat *vVertices;
GLfloat *vTextures;
GLushort *indices;
GLuint indices_num;
GLuint vao,vbo1,vbo2,ebo;float projectionMatrix[16];
float modelMatrix[16];
float viewMatrix[16];
float angleX = 30.0f;
float angleY = 0.0f;
float angleZ = 0.0f;struct window {struct wl_surface *surface;struct xdg_surface *xdg_surface;struct xdg_toplevel *xdg_toplevel;struct wl_egl_window *egl_window;
};static void
xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{xdg_wm_base_pong(shell, serial);
}/*for xdg_wm_base listener*/
static const struct xdg_wm_base_listener wm_base_listener = {xdg_wm_base_ping,
};/*for registry listener*/
static void registry_add_object(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) 
{if (!strcmp(interface, "wl_compositor")) {compositor = (struct wl_compositor *)wl_registry_bind(registry, name, &wl_compositor_interface, 1);} else if (strcmp(interface, "xdg_wm_base") == 0) {wm_base = (struct xdg_wm_base *)wl_registry_bind(registry, name,&xdg_wm_base_interface, 1);xdg_wm_base_add_listener(wm_base, &wm_base_listener, NULL);}
}void registry_remove_object(void *data, struct wl_registry 
http://www.dt0577.cn/news/20961.html

相关文章:

  • asp.net 网站开发架构百度关键词下拉有什么软件
  • 怎样制作网站后台万网商标查询
  • 专业网站建设是哪家好制作自己的网站
  • 东莞网站建设公司 网络服务电商平台开发
  • 上海网站建设设计制作seo课程培训课程
  • 微信网页版网址是多少seo自然排名优化
  • 长沙商城网站制作seo常用的工具
  • 塘沽做网站长沙网络推广外包费用
  • 环保行业网站开发福州短视频seo机会
  • 计算机网络设计实验报告南宁seo主管
  • 凯里网站建设公司外链购买平台
  • 东莞医院网站建设汉中网络推广
  • 电子请柬网站开发百度指数使用方法
  • 今日头条做网站网络营销的八种方式
  • 做学校网站素材图片网站推广的要点
  • 网站制作教程dwseo优化工作有哪些
  • 做网站还有市场吗现在的网络推广怎么做
  • 移动端网站制作站长工具站长之家
  • 网站备案要网站做才可以使用吗建站企业网站
  • 网站建设与管理 期末提高工作效率的工具
  • 空壳网站清理通知海外网站cdn加速
  • 网站做板块地图的办法北海百度seo
  • 企业网站建设 制作网络营销的背景和意义
  • 电商平台模板怎么快速优化网站
  • 济南推广网站建设南宁百度seo排名价格
  • 山东临沂网站建设磁力吧
  • 编辑网站内容怎么做滚动图片成都专门做网络推广的公司
  • 河南网站建设路东莞做网站推广的公司
  • 网页设计类网站网站换了域名怎么查
  • 网站做节日营销活动的目的如何设计推广方案