Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
component:hologram:zh [2023/11/26 15:02]
hfsr created
component:hologram:zh [2023/11/28 05:54] (current)
hfsr [组件:全息影像]
Line 1: Line 1:
-Component: Hologram+组件:全息影像
 ================== ==================
-This component is provided by the [[block:​hologram_projector|Hologram Projector]]  +此组件由[[block:​hologram_projector:zh|全息投影仪]]提供。 ​  
-These can be used to create holographic projections in a resolution of 48x32x48, over a maximum area of 9x6x9 blocks. Tier two holograms do not provide a higher resolution, instead they allow using up to three colors in the displayed hologram (as opposed to just one for the tier one hologram).+以下函数可用于创建全息影像,其分辨率为48x32x48,投影范围最大为9x6x9格。2级全息投影仪的分辨率并未提高,但是可以用至多三种颜色显示全息投影(1级全息投影仪只能用一种)。
  
-Component name: `hologram`.  ​ +组件名:`hologram` 
-Callbacks:+ 
 +回调函数:
  
 - `clear()`  ​ - `clear()`  ​
-  ​Clears the hologram.+  ​清除全息影像。 ​  
 +\\
 - `get(x:​number,​ y:number, z:​number):​number`  ​ - `get(x:​number,​ y:number, z:​number):​number`  ​
-  ​Returns the value at the specified position.+  ​返回全息影像指定坐标处的值。 ​  
 +\\
 - `set(x:​number,​ y:number, z:number, value:​number or boolean)`  ​ - `set(x:​number,​ y:number, z:number, value:​number or boolean)`  ​
-  ​Set the value for the specified position.+  ​设定全息影像指定坐标处的值。 ​  
 +\\
 - `fill(x:​number,​ z:number[, minY:​number],​ maxY:​number,​ value:​number)`  ​ - `fill(x:​number,​ z:number[, minY:​number],​ maxY:​number,​ value:​number)`  ​
-  ​Fills an interval in the specified column column with the specified value. Will overwrite only the voxels in the interval. If `minY` ​is omitted it defaults to 1. The two interval ends are inclusive. ​  +  ​用给定值填充指定柱状区域中的一个区间,只会覆写区间内的体素。若省略`minY`则默认为1。作用范围包含区间的两端。 ​  
-  //​Note://​ Before ​1.3.3 there was no `minY` ​argument and all voxels below and including the specified height would be set, all voxels above would be unset.+**注意:**在1.3.3版本前并没有`minY`参数,指定高度处及其下方的所有体素都将被赋值,指定高度上方的所有体素都不会被赋值。 ​  
 +\\
 - `copy(x:​number,​ z:number, sx:number, sz:number, tx:number, tz:​number)`  ​ - `copy(x:​number,​ z:number, sx:number, sz:number, tx:number, tz:​number)`  ​
-  ​Copies an area of columns by the specified translation.+  ​遵从给定的位置变换,复制一个柱状区域。 ​  
 +\\
 - `getScale():​number`  ​ - `getScale():​number`  ​
-  ​Returns the current render scale of the hologram.+  ​返回当前全息影像的渲染缩放比例。 ​  
 +\\
 - `setScale(value:​number)`  ​ - `setScale(value:​number)`  ​
-  ​Set the render scale. A larger scale consumes more energy. The minimum scale is 0.33, where the hologram will fit in a single block space, the maximum scale is 3, where the hologram will take up a 9x6x9 block space. +  ​设定渲染缩放比例。缩放比例越大则耗能越多。做小缩放比例为0.33,此时全息投影的大小在一个方块以内。最大缩放比例为3,此时全息投影会占据9x6x9格的空间。 ​  
-- `getTranslation:​number,​ number, number` +\\ 
-  ​Return the current translation offset.+- `getTranslation:​number,​ number, number` ​  
 +  ​返回当前的位置变换偏移量。 ​  
 +\\
 - `setTranslation(x:​number,​ y:number, z:number)` - `setTranslation(x:​number,​ y:number, z:number)`
-  ​Set the translation vector. The hologram display will be offset by this vector from its normal location. The maximum allowable translation is a function of tier. Units are the hologram'​s size, so the distance translated increases and decreases with scale as well.+  ​设定位置变换向量。全息投影显示时将会从默认位置以此向量为偏移值进行偏移。最大允许偏移值与投影仪等级有关。偏移值的单位为全息投影的尺寸,因此位置改变的距离远近也会随着缩放比例而增减。 ​  
 +\\
 - `maxDepth():​number`  ​ - `maxDepth():​number`  ​
-  ​The color depth supported by the hologram.+  ​全息影像支持的色深。 ​  
 +\\
 - `getPaletteColor(index:​number):​number`  ​ - `getPaletteColor(index:​number):​number`  ​
-  ​Get the hex color defined for the specified value.+  ​获取定义给指定值的16进制颜色。 ​  
 +\\
 - `setPaletteColor(index:​number,​ value:​number):​number`  ​ - `setPaletteColor(index:​number,​ value:​number):​number`  ​
-  ​Set the hex color defined for the specified value.+  ​设置定义给指定值的16进制颜色。\\
  
-Simple example program that allows setting individual voxels:+下面是一个简单的程序样例,可用于设定不同体素的值:
 ```lua ```lua
 local component = require("​component"​) local component = require("​component"​)
Line 41: Line 53:
 ``` ```
  
-Example use (assuming it's saved as `holo-set.lua`):  +使用例(假设上述程序被保存为`holo-set.lua`): ​ 
 `# holo-set 16 8 20 true` `# holo-set 16 8 20 true`
  
-Further examples:+高级样例:
  
 - [Holo Flow](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​holo-flow.lua)  ​ - [Holo Flow](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​holo-flow.lua)  ​
-  ​This program generates a heightmap and '​moves'​ across it over time, creating the effect of a flowing terrain.+  ​此程序生成了一张高度图,并在上面“移动”。制造了滚动的大地的效果。  ​
 - [Holo Text](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​holo-text.lua)  ​ - [Holo Text](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​holo-text.lua)  ​
-  ​This program generates a random heightmap and displays scrolling text above it.+  ​此程序生成了一张随机的高度图,并在其上方显示了滚动的文本。  ​
  
-Note, the second example is quite a bit more advanced then the first. ​**Important**: both scripts also need the [noise.lua](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​noise.lua) ​script to be in the same folder.+请注意,第二个样例要比第一个高级的多。 ​  
 +**重要事项:**两个脚本都需要同一个文件夹中有[noise.lua](https://​github.com/​OpenPrograms/​Sangar-Programs/​blob/​master/​noise.lua)脚本才能工作。
  
 目录 目录
 ---- ----
 {{page>​component:​contents:​zh&​noheader&​noeditbutton&​nouser&​nofooter}} {{page>​component:​contents:​zh&​noheader&​noeditbutton&​nouser&​nofooter}}