GLTFExporter是一个用于将3D场景导出为glTF格式的JavaScript库。

demo案例
在这里插入图片描述

GLTFExporter是一个用于将3D场景导出为glTF格式的JavaScript库。下面我将逐个讲解其入参、出参、属性、方法以及API使用方式。

入参(Input Parameters):

GLTFExporter的主要入参是要导出的场景对象和一些导出选项。具体来说:

  1. scene(场景对象): 这是要导出的3D场景对象,通常是使用Three.js等库构建的场景。
  2. options(导出选项): 这是一个可选的对象,其中包含一些配置项,用于控制导出的行为。例如,您可以指定是否将纹理嵌入到输出文件中、是否包含额外的信息等。

出参(Output):

GLTFExporter的出参是导出的glTF文件。根据您的配置,它可能是一个二进制文件(.glb)或包含多个文件的文件夹(.gltf)。

属性(Properties):

GLTFExporter对象可能具有一些属性,用于配置导出的行为。这些属性通常是一些默认设置,如缩放系数等。

方法(Methods):

GLTFExporter包含了执行导出的方法。

  1. parse(scene, options, onCompleted, onError): 这个方法执行实际的导出过程。它接受场景对象、导出选项以及两个回调函数作为参数。第一个回调函数(onCompleted)在导出成功完成时调用,并接收导出的结果作为参数。第二个回调函数(onError)在导出过程中出现错误时调用。

API方式使用(API Usage):

使用GLTFExporter的基本流程通常如下:

  1. 创建GLTFExporter对象。
  2. 定义导出选项(可选)。
  3. 使用parse方法将场景导出为glTF格式。
  4. 处理导出的结果,如保存到文件或进一步处理。

示例代码:

// 导入GLTFExporter库
import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';// 创建GLTFExporter对象
const exporter = new GLTFExporter();// 定义导出选项(可选)
const options = {binary: true, // 是否以二进制格式输出(默认为false,输出为.gltf文件)includeCustomExtensions: true, // 是否包含自定义扩展信息trs: true, // 是否将几何体的位置、旋转和缩放信息导出animations: [], // 要导出的动画(如果有的话)embedImages: false // 是否将图片嵌入到gltf文件中
};// 使用parse方法导出场景为glTF格式
exporter.parse(scene, options, function (result) {// 处理导出的结果if (result instanceof ArrayBuffer) {// 以二进制格式输出saveArrayBuffer(result, 'scene.glb');} else {// 以JSON格式输出const output = JSON.stringify(result, null, 2);saveString(output, 'scene.gltf');}
}, function (error) {// 处理导出过程中出现的错误console.error('Export error:', error);
});// 保存导出的文件
function saveArrayBuffer(buffer, filename) {// 实现保存二进制文件的逻辑
}function saveString(text, filename) {// 实现保存JSON文件的逻辑
}

所有源码


```html
<!DOCTYPE html>
<html lang="en">
<head><!-- 页面标题 --><title>three.js webgl - exporter - gltf</title><meta charset="utf-8"><!-- 响应式布局 --><meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"><!-- 引入 CSS 文件 --><link type="text/css" rel="stylesheet" href="main.css">
</head>
<body><!-- 信息提示 --><div id="info"><a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - exporter - gltf</div><!-- 导入映射 --><script type="importmap">{"imports": {"three": "../build/three.module.js","three/addons/": "./jsm/"}}</script><!-- 主要 JavaScript 代码 --><script type="module">// 导入所需的模块import * as THREE from 'three';  // 导入 three.js 库import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js';  // 导入 GLTFExporter 模块import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';  // 导入 GLTFLoader 模块import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';  // 导入 KTX2Loader 模块import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';  // 导入 MeshoptDecoder 模块import { GUI } from 'three/addons/libs/lil-gui.module.min.js';  // 导入 GUI 模块// 导出 GLTF 文件的函数function exportGLTF( input ) {const gltfExporter = new GLTFExporter();const options = {trs: params.trs,onlyVisible: params.onlyVisible,binary: params.binary,maxTextureSize: params.maxTextureSize};gltfExporter.parse(input,function ( result ) {if ( result instanceof ArrayBuffer ) {saveArrayBuffer( result, 'scene.glb' );} else {const output = JSON.stringify( result, null, 2 );console.log( output );saveString( output, 'scene.gltf' );}},function ( error ) {console.log( 'An error happened during parsing', error );},options);}// 创建保存链接的函数const link = document.createElement( 'a' );link.style.display = 'none';document.body.appendChild( link ); // Firefox 的兼容性解决方案,见 #6594// 保存文件的函数function save( blob, filename ) {link.href = URL.createObjectURL( blob );link.download = filename;link.click();// URL.revokeObjectURL( url ); breaks Firefox...}// 保存字符串到文件的函数function saveString( text, filename ) {save( new Blob( [ text ], { type: 'text/plain' } ), filename );}// 保存 ArrayBuffer 到文件的函数function saveArrayBuffer( buffer, filename ) {save( new Blob( [ buffer ], { type: 'application/octet-stream' } ), filename );}// 全局变量定义let container;  // 容器let camera, object, object2, material, geometry, scene1, scene2, renderer;  // 相机、物体、材质、几何体、场景、渲染器等let gridHelper, sphere, model, coffeemat;  // 网格帮助器、球体、模型、材质等// 参数定义const params = {trs: false,onlyVisible: true,binary: false,maxTextureSize: 4096,exportScene1: exportScene1,exportScenes: exportScenes,exportSphere: exportSphere,exportModel: exportModel,exportObjects: exportObjects,exportSceneObject: exportSceneObject,exportCompressedObject: exportCompressedObject,};// 初始化函数init();animate();// 初始化函数function init() {container = document.createElement( 'div' );document.body.appendChild( container );// 纹理数据const data = new Uint8ClampedArray( 100 * 100 * 4 );for ( let y = 0; y < 100; y ++ ) {for ( let x = 0; x < 100; x ++ ) {const stride = 4 * ( 100 * y + x );data[ stride ] = Math.round( 255 * y / 99 );data[ stride + 1 ] = Math.round( 255 - 255 * y / 99 );data[ stride + 2 ] = 0;data[ stride + 3 ] = 255;}}// 渐变纹理const gradientTexture = new THREE.DataTexture( data, 100, 100, THREE.RGBAFormat );gradientTexture.minFilter = THREE.LinearFilter;gradientTexture.magFilter = THREE.LinearFilter;gradientTexture.needsUpdate = true;// 第一个场景scene1 = new THREE.Scene();scene1.name = 'Scene1';// 透视相机camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );camera.position.set( 600, 400, 0 );camera.name = 'PerspectiveCamera';scene1.add( camera );// 环境光const ambientLight = new THREE.AmbientLight( 0xcccccc );ambientLight.name = 'AmbientLight';scene1.add( ambientLight );// 平行光const dirLight = new THREE.DirectionalLight( 0xffffff, 3 );dirLight.target.position.set( 0, 0, - 1 );dirLight.add( dirLight.target );dirLight.lookAt( - 1, - 1, 0 );dirLight.name = 'DirectionalLight';scene1.add( dirLight );// 网格辅助器gridHelper = new THREE.GridHelper( 2000, 20, 0xc1c1c1, 0x8d8d8d );gridHelper.position.y = - 50;gridHelper.name = 'Grid';scene1.add( gridHelper );// 坐标轴辅助器const axes = new THREE.AxesHelper( 500 );axes.name = 'AxesHelper';scene1.add( axes );// 基本材质的简单几何体// 二十面体const mapGrid = new THREE.TextureLoader().load( 'textures/uv_grid_opengl.jpg' );mapGrid.wrapS = mapGrid.wrapT = THREE.RepeatWrapping;mapGrid.colorSpace = THREE.SRGBColorSpace;material = new THREE.MeshBasicMaterial( {color: 0xffffff,map: mapGrid} );object = new THREE.Mesh( new THREE.IcosahedronGeometry( 75, 0 ), material );object.position.set( - 200, 0, 200 );object.name = 'Icosahedron';scene1.add( object );// 八面体material = new THREE.MeshBasicMaterial( {color: 0x0000ff,wireframe: true} );object = new THREE.Mesh( new THREE.OctahedronGeometry( 75, 1 ), material );object.position.set( 0, 0, 200 );object.name = 'Octahedron';scene1.add( object );// 四面体material = new THREE.MeshBasicMaterial( {color: 0xff0000,transparent: true,opacity: 0.5} );object = new THREE.Mesh( new THREE.TetrahedronGeometry( 75, 0 ), material );object.position.set( 200, 0, 200 );object.name = 'Tetrahedron';scene1.add( object );// 缓冲几何体原语// 球体material = new THREE.MeshStandardMaterial( {color: 0xffff00,metalness: 0.5,roughness: 1.0,flatShading: true,} );material.map = gradientTexture;material.bumpMap = mapGrid;sphere = new THREE.Mesh( new THREE.SphereGeometry( 70, 10, 10 ), material );sphere.position.set( 0, 0, 0 );sphere.name = 'Sphere';scene1.add( sphere );// 圆柱体material = new THREE.MeshStandardMaterial( {color: 0xff00ff,flatShading: true} );object = new THREE.Mesh( new THREE.CylinderGeometry( 10, 80, 100 ), material );object.position.set( 200, 0, 0 );object.name = 'Cylinder';scene1.add( object );// 环面纹理material = new THREE.MeshStandardMaterial( {color: 0xff0000,roughness: 1} );object = new THREE.Mesh( new THREE.TorusKnotGeometry( 50, 15, 40, 10 ), material );object.position.set( - 200, 0, 0 );object.name = 'Cylinder';scene1.add( object );// 组合体const mapWood = new THREE.TextureLoader().load( 'textures/hardwood2_diffuse.jpg' );material = new THREE.MeshStandardMaterial( { map: mapWood, side: THREE.DoubleSide } );object = new THREE.Mesh( new THREE.BoxGeometry( 40, 100, 100 ), material );object.position.set( - 200, 0, 400 );object.name = 'Cube';scene1.add( object );object2 = new THREE.Mesh( new THREE.BoxGeometry( 40, 40, 40, 2, 2, 2 ), material );object2.position.set( 0, 0, 50 );object2.rotation.set( 0, 45, 0 );object2.name = 'SubCube';object.add( object2 );// 群组const group1 = new THREE.Group();group1.name = 'Group';scene1.add( group1 );const group2 = new THREE.Group();group2.name = 'subGroup';group2.position.set( 0, 50, 0 );group1.add( group2 );object2 = new THREE.Mesh( new THREE.BoxGeometry( 30, 30, 30 ), material );object2.name = 'Cube in group';object2.position.set( 0, 0, 400 );group2.add( object2 );// 线条geometry = new THREE.BufferGeometry();let numPoints = 100;let positions = new Float32Array( numPoints * 3 );for ( let i = 0; i < numPoints; i ++ ) {positions[ i * 3 ] = i;positions[ i * 3 + 1 ] = Math.sin( i / 2 ) * 20;positions[ i * 3 + 2 ] = 0;}geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );object = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );object.position.set( - 50, 0, - 200 );scene1.add( object );// 线环geometry = new THREE.BufferGeometry();numPoints = 5;const radius = 70;positions = new Float32Array( numPoints * 3 );for ( let i = 0; i < numPoints; i ++ ) {const s = i * Math.PI * 2 / numPoints;positions[ i * 3 ] = radius * Math.sin( s );positions[ i * 3 + 1 ] = radius * Math.cos( s );positions[ i * 3 + 2 ] = 0;}geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );object = new THREE.LineLoop( geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );object.position.set( 0, 0, - 200 );scene1.add( object );// 点numPoints = 100;const pointsArray = new Float32Array( numPoints * 3 );for ( let i = 0; i < numPoints; i ++ ) {pointsArray[ 3 * i ] = - 50 + Math.random() * 100;pointsArray[ 3 * i + 1 ] = Math.random() * 100;pointsArray[ 3 * i + 2 ] = - 50 + Math.random() * 100;}const pointsGeo = new THREE.BufferGeometry();pointsGeo.setAttribute( 'position', new THREE.BufferAttribute( pointsArray, 3 ) );const pointsMaterial = new THREE.PointsMaterial( { color: 0xffff00, size: 5 } );const pointCloud = new THREE.Points( pointsGeo, pointsMaterial );pointCloud.name = 'Points';pointCloud.position.set( - 200, 0, - 200 );scene1.add( pointCloud );// 正交相机const cameraOrtho = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, 0.1, 10 );scene1.add( cameraOrtho );cameraOrtho.name = 'OrthographicCamera';material = new THREE.MeshLambertMaterial( {color: 0xffff00,side: THREE.DoubleSide} );object = new THREE.Mesh( new THREE.CircleGeometry( 50, 20, 0, Math.PI * 2 ), material );object.position.set( 200, 0, - 400 );scene1.add( object );object = new THREE.Mesh( new THREE.RingGeometry( 10, 50, 20, 5, 0, Math.PI * 2 ), material );object.position.set( 0, 0, - 400 );scene1.add( object );object = new THREE.Mesh( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), material );object.position.set( - 200, 0, - 400 );scene1.add( object );//const points = [];for ( let i = 0; i < 50; i ++ ) {points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * Math.sin( i * 0.1 ) * 15 + 50, ( i - 5 ) * 2 ) );}object = new THREE.Mesh( new THREE.LatheGeometry( points, 20 ), material );object.position.set( 200, 0, 400 );scene1.add( object );// 用于测试 `onlyVisible` 选项的隐藏的大红色盒子material = new THREE.MeshBasicMaterial( {color: 0xff0000} );object = new THREE.Mesh( new THREE.BoxGeometry( 200, 200, 200 ), material );object.position.set( 0, 0, 0 );object.name = 'CubeHidden';object.visible = false;scene1.add( object );// 需要 KHR_mesh_quantization 的模型const loader = new GLTFLoader();loader.load( 'models/gltf/ShaderBall.glb', function ( gltf ) {model = gltf.scene;model.scale.setScalar( 50 );model.position.set( 200, - 40, - 200 );scene1.add( model );} );// 需要 KHR_mesh_quantization 的模型material = new THREE.MeshBasicMaterial( {color: 0xffffff,} );object = new THREE.InstancedMesh( new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ), material, 50 );const matrix = new THREE.Matrix4();const color = new THREE.Color();for ( let i = 0; i < 50; i ++ ) {matrix.setPosition( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );object.setMatrixAt( i, matrix );object.setColorAt( i, color.setHSL( i / 50, 1, 0.5 ) );}object.position.set( 400, 0, 200 );scene1.add( object );// 第二个 THREE.Scenescene2 = new THREE.Scene();object = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );object.position.set( 0, 0, 0 );object.name = 'Cube2ndScene';scene2.name = 'Scene2';scene2.add( object );renderer = new THREE.WebGLRenderer( { antialias: true } );renderer.setPixelRatio( window.devicePixelRatio );renderer.setSize( window.innerWidth, window.innerHeight );renderer.toneMapping = THREE.ACESFilmicToneMapping;renderer.toneMappingExposure = 1;container.appendChild( renderer.domElement );window.addEventListener( 'resize', onWindowResize );// 导出压缩的纹理和网格(KTX2 / Draco / Meshopt)const ktx2Loader = new KTX2Loader().setTranscoderPath( 'jsm/libs/basis/' ).detectSupport( renderer );const gltfLoader = new GLTFLoader().setPath( 'models/gltf/' );gltfLoader.setKTX2Loader( ktx2Loader );gltfLoader.setMeshoptDecoder( MeshoptDecoder );gltfLoader.load( 'coffeemat.glb', function ( gltf ) {gltf.scene.position.x = 400;gltf.scene.position.z = - 200;scene1.add( gltf.scene );coffeemat = gltf.scene;} );const gui = new GUI();let h = gui.addFolder( 'Settings' );h.add( params, 'trs' ).name( 'Use TRS' );h.add( params, 'onlyVisible' ).name( 'Only Visible Objects' );h.add( params, 'binary' ).name( 'Binary (GLB)' );h.add( params, 'maxTextureSize', 2, 8192 ).name( 'Max Texture Size' ).step( 1 );h = gui.addFolder( 'Export' );h.add( params, 'exportScene1' ).name( 'Export Scene 1' );h.add( params, 'exportScenes' ).name( 'Export Scene 1 and 2' );h.add( params, 'exportSphere' ).name( 'Export Sphere' );h.add( params, 'exportModel' ).name( 'Export Model' );h.add( params, 'exportObjects' ).name( 'Export Sphere With Grid' );h.add( params, 'exportSceneObject' ).name( 'Export Scene 1 and Object' );h.add( params, 'exportCompressedObject' ).name( 'Export Coffeemat (from compressed data)' );gui.open();}function exportScene1() {exportGLTF( scene1 );}function exportScenes() {exportGLTF( [ scene1, scene2 ] );}function exportSphere() {exportGLTF( sphere );}function exportModel() {exportGLTF( model );}function exportObjects() {exportGLTF( [ sphere, gridHelper ] );}function exportSceneObject() {exportGLTF( [ scene1, gridHelper ] );}function exportCompressedObject() {exportGLTF( [ coffeemat ] );}function onWindowResize() {camera.aspect = window.innerWidth / window.innerHeight;camera.updateProjectionMatrix();renderer.setSize( window.innerWidth, window.innerHeight );}function animate() {requestAnimationFrame( animate );render();}function render() {const timer = Date.now() * 0.0001;camera.position.x = Math.cos( timer ) * 800;camera.position.z = Math.sin( timer ) * 800;camera.lookAt( scene1.position );renderer.render( scene1, camera );}</script></body>
</html>

本内容来源于小豆包,想要更多内容请跳转小豆包 》

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/778882.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

PowerBI加权计算权重

1.打开主页&#xff0c;点击快速度量值 2.计算里面 选择计算&#xff1a;每个类别的加权平均值 3.就是添加数据&#xff0c;基值&#xff08;就是你要计算的值&#xff09;粗细&#xff08;就是你要用那个值计算权重&#xff09;类别&#xff08;就是你是要乘以那个类别&#x…

Openstack常用命令总结-Nova篇

nova help <subcommand> 查询某一子命令的语法 列出虚机 nova list --all --host <hostname> 列出某一宿主机上所有虚机nova list --all --name <name-regexp> 根据名称&#xff08;无需全名&#xff09;搜索虚机 获取虚机详情、租户名 1、nova show <…

前端超分辨率技术应用:图像质量提升与场景实践探索-设计篇

超分辨率&#xff01; 引言 在数字化时代&#xff0c;图像质量对于用户体验的重要性不言而喻。随着显示技术的飞速发展&#xff0c;尤其是移动终端视网膜屏幕的广泛应用&#xff0c;用户对高分辨率、高质量图像的需求日益增长。然而&#xff0c;受限于网络流量、存储空间和图像…

政安晨:专栏目录【TensorFlow与Keras机器学习实战】

政安晨的个人主页&#xff1a;政安晨 欢迎 &#x1f44d;点赞✍评论⭐收藏 收录专栏: TensorFlow与Keras机器学习实战 希望政安晨的博客能够对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论区提出指正&#xff01; 本篇是作者政安晨的专栏《TensorFlow与Keras机器…

linux网络服务学习(4):SAMBA

1.什么是SAMBA SAMBA也是一种文件共享工具 &#xff08;1&#xff09;服务名&#xff1a;smb &#xff08;2&#xff09;软件名&#xff1a;samba &#xff08;3&#xff09;配置文件&#xff1a; /etc/samba/smb.conf /etc/samba/smb.conf.example &#xff08;4&#…

解决npm init vue@latest证书过期问题:npm ERR! code CERT_HAS_EXPIRED

目录 一. 问题背景 二. 错误信息 三. 解决方案 3.1 临时解决办法 3.2 安全性考量 一. 问题背景 我在试图创建一个新的Vue.js项目时遇到了一个问题&#xff1a;npm init vuelatest命令出现了证书过期的错误。不过这是一个常见的问题&#xff0c;解决起来也简单。 二. 错误…

LeetCode:718最长重复子数组 C语言

718. 最长重复子数组 提示 给两个整数数组 nums1 和 nums2 &#xff0c;返回 两个数组中 公共的 、长度最长的子数组的长度 。 示例 1&#xff1a; 输入&#xff1a;nums1 [1,2,3,2,1], nums2 [3,2,1,4,7] 输出&#xff1a;3 解释&#xff1a;长度最长的公共子数组是 [3,…

Python基本运算

1.逻辑运算符 第四行会有黄色的下划线是因为这个不是系统推荐的写法&#xff0c;系统推荐的是第五行的链式比较&#xff1b; 2.短路求值 对于and而言&#xff0c;左边的语句是false&#xff0c;那么整体一定是false,右边的表达式就不会进行计算&#xff1b; 对于or而言&…

【ARM64 常见汇编指令学习 21 -- ARM RET 与 ERET】

请阅读【嵌入式开发学习必备专栏 】 文章目录 ARM RET 与 ERETARMv8 ERET 指令RET 与 ERET 的区别 ARM RET 与 ERET 在 ARMv8 架构中&#xff0c;RET 指令用于从函数或者过程返回。它主要负责从当前过程跳转回调用者&#xff0c;并恢复调用者的程序计数器 (PC) 的值。 语法&a…

【数据结构】——栈与队列(附加oj题详解)深度理解

栈 1.栈的定义 栈&#xff1a;栈是仅限与在表尾进行插入或者删除的线性表 我们把允许一端插入和删除的一端叫做栈顶&#xff0c;另一端叫栈底&#xff0c;不含任何元素的栈叫做空栈&#xff0c;栈又叫做后进先出的线性表&#xff0c;简称LIFO结构 2.栈的理解 对于定义里面…

机器学习导论:概念、分类与应用场景

​​​​​​​目录 1.引言 2. 机器学习基本概念与分类方法 2.1. 基本概念 1.2. 分类方法 3.主要应用场景与现实案例剖析 3.1. 推荐系统 3.2. 金融风控 3.3. 医学诊断 3.4. 自然语言处理 4.结束语 1.引言 在数字化时代&#xff0c;数据已成为驱动社会进步的关键要素。…

面向对象的学习

封装 //用来描述一类事物的类&#xff0c;专业叫做&#xff1a;javabean类 //在javabean类是不写main方法的//一个java文件中可以定义多个类&#xff0c;且只能一个类是public修饰&#xff0c;而且public修饰的类名必须成为代码的文件名 ://在类中一般无需指定初始化值 存在默…

CleanMyMac X 4.15.1 for Mac 最新中文破解版 系统优化垃圾清理工具

CleanMyMac X for Mac 是一款功能更加强大的系统优化清理工具&#xff0c;相比于 CleanMyMac 4.15.1来说&#xff0c;功能增加了不少&#xff0c;此版本为4.15.1官方最新中英文正式破解版本&#xff0c;永久使用&#xff0c;解决了打开软件崩溃问题&#xff0c;最新版4.15.1版本…

centos7 安装es8.12.0

在CentOS操作系统上安装Elasticsearch&#xff08;ES&#xff09;通常涉及以下步骤。虽然您提供的信息中包含了多个不同时间点和版本的安装指南片段&#xff0c;但这里我会为您概述一个通用且适用于较新版本Elasticsearch&#xff08;如7.x或8.x&#xff09;的安装流程。请根据…

MYSQL数字函数实操宝典:场景化SQL语句一网打尽

​&#x1f308; 个人主页&#xff1a;danci_ &#x1f525; 系列专栏&#xff1a;《设计模式》《MYSQL应用》 &#x1f4aa;&#x1f3fb; 制定明确可量化的目标&#xff0c;坚持默默的做事。 MYSQL数字函数&#xff1a;不可不知的数据处理利器 文章目录 Part 1: 准备 &#x…

node.js 常见命令

1. npm init: 初始化一个新的Node.js项目&#xff0c;创建一个package.json文件。 2. npm install: 安装项目所需的所有依赖项。 3. npm run: 运行在package.json文件中定义的脚本。 4. node index.js: 运行一个Node.js文件。 5. node -v: 查看当前安装的Node.js版本号。 6. np…

3723. 字符串查询:做题笔记

目录 思路 代码 注意点 3723. 字符串查询 思路 这道题感觉和常见的前缀和问题不太一样&#xff0c;前缀和的另一种应用&#xff1a;可以统计次数。 这道题我们想判断一个单词的其中一段子序列A是否可以通过重新排列得到另一段子序列B。 我看到这道题的时候想着可能要判…

算法日记————对顶堆(4道题)

对顶堆的作用主要在于动态维护第k大的数字&#xff0c;考虑使用两个优先队列&#xff0c;一个大9999999999根堆一个小根堆&#xff0c;小根堆维护大于等于第k大的数字的数&#xff0c;它的堆顶就是堆内最小&#xff0c;第k大的数字&#xff0c;另外一个大根堆维护小于等于k的数…

FFTW算法库实现DCT变换

FFTW库安装与使用(3.3.5版本)_jhon-ranble-GitCode 开源社区 信号处理算法(4):全球最快的傅里叶变换算法(FFTW)-CSDN博客

资讯头条P3自媒体搭建

自媒体素材管理与文章管理 一.后台搭建 1.1 搭建自媒体网关 导入网关模块>>>在网关模块的pom.xml文件中添加该子模块>>>刷新maven <modules><module>heima-leadnews-app-gateway</module><!--新增--><module>heima-leadnew…