Merge pull request #208 from google/update_conv

Update conventions text of spec
This commit is contained in:
FrankGalligan 2017-10-02 15:06:59 -07:00 committed by GitHub
commit 4f77ea0ac2
6 changed files with 139 additions and 16 deletions

View File

@ -1,33 +1,156 @@
## Conventions ## Conventions
### Draco File Format
* All Draco encoded mesh files are comprised of four main sections. This first
section is the header. The second section contains the metadata. This section is optional. The third section contains the connectivity data. The fourth section contains the attribute data.
![Draco_file](images/draco_file.png)
* The header must be decoded first, then the metadata section (if present), then the connectivity section, and then the attribute section.
#### Sequential Connectivity
* The sequential connectivity is comprised of two sections. The first section is the connectivity header. The second section is the indices data.
![sequential_connectivity](images/sequential_connectivity.png)
#### EdgeBreaker Connectivity
* The EdgeBreaker connectivity section is composed of five sections. The first section is the connectivity header. The second section is the encoded EdgeBreaker symbol data. The third section is the encoded start face configuration data. The fourth section is the encoded split data.The fifth section is the attribute connectivity data.
![edgebreaker_connectivity](images/edgebreaker_connectivity.png)
* The encoded split data must be decoded before the EdgeBreaker symbols are decoded. The offset to the split data is contained in the connectivity header.
#### Valence EdgeBreaker Connectivity
* The valence EdgeBreaker connectivity inserts two sections in between the start face data and the split data. The first section is the EdgeBreaker valence header. The second section is the context data for the valence prediction.
![edgebreaker_valence_connectivity](images/edgebreaker_valence_connectivity.png)
#### Attributes
* The attributes data contains two sections. The first section is the attribute header. The second section is comprised of one or more attribute types, such as positions, texture coordinates, normals… Each attribute type section is comprised of one or more unique attributes.
![attributes](images/attributes.png)
### Draco Conventions
* When bit reading is finished it will always pad the read to the current
byte.
* varUI32 and varUI64 types must be decoded by the DecodeVarint() function.
### General Conventions ### General Conventions
* When bit reading is finished it will always pad the read to the current
byte.
* varUI32 and varUI64 types must be decoded by the DecodeVarint() function. The mathematical operators and their precedence rules used to describe this
Specification are similar to those used in the C programming language.
* Draco encoded mesh files are comprised of three main sections. This first Assignment of an array is represented using the normal notation `A = B` and is
section is the header. The second section contains the connectivity data. specified to mean the same as doing both the individual assignments
The third section contains the attribute data. The header must be decoded `A[ 0 ] = B[ 0 ]` and `A[ 1 ] = B[ 1 ].` Equality testing of 2 arrays is
first, then the connectivity section, and then the attribute section. represented using the notation `A == B` and is specified to mean the same as
`(A[ 0 ] == B[ 0 ] && A[ 1 ] == B[ 1 ])`. Inequality testing is defined as
`A != B` and is specified to mean the same as
`(A[ 0 ] != B[ 0 ] || A[ 1 ] != B[ 1 ])`. The functions `assign` and
`push_back` behave simialrily on arrays as it is defined for c++ std::vector.
* The Connectivity section is composed of the following sections in order: When a variable is said to be representable by a signed integer with `x` bits,
it means that the variable is greater than or equal to `-(1 << (x-1))`, and that
the variable is less than or equal to `(1 << (x-1))-1`.
* Connectivity header
* EdgeBreaker symbol buffer ### Arithmetic operators
* Start face buffer | | |
|:--------:| ------- |
| `+` | Addition
| `` | Subtraction (as a binary operator) or negation (as a unary prefix operator)
| `*` | Multiplication
| `/` | Division
| `a % b` | Remainder from division of `a` by `b`. Both `a` and `b` are positive integers.
{:.conventions }
* EdgeBreaker valence header
* Context data for the valence prediction ### Logical operators
* Split data | | |
|:--------:| ------- |
| `a && b` | Logical AND operation between `a` and `b`
| `a || b` | Logical OR operation between `a` and `b`
| `!` | Logical NOT operation.
{:.conventions }
### Relational operators
| | |
|:--------:| ------- |
| `>` | Greater than
| `>=` | Greater than or equal to
| `<` | Less than
| `<=` | Less than or equal to
| `==` | Equal to
| `!=` | Not equal to
{:.conventions }
### Bitwise operators
| | |
|:--------:| ------- |
| `&` | AND operation
| `|` | OR operation
| `~` | Negation operation
| `a >> b` | Shift `a` in 2's complement binary integer representation format to the right by `b` bit positions. This operator is only used with `b` being a non-negative integer. Bits shifted into the MSBs as a result of the right shift have a value equal to the MSB of `a` prior to the shift operation.
| `a << b` | Shift `a` in 2's complement binary integer representation format to the left by `b` bit positions. This operator is only used with `b` being a non-negative integer. Bits shifted into the LSBs as a result of the left shift have a value equal to `0`.
{:.conventions }
### Assignment
| | |
|:--------:| ------- |
| `=` | Assignment operator
| `++` | Increment, `x++` is equivalent to `x = x + 1`. When this operator is used for an array index, the variable value is obtained before the auto increment operation
| `--` | Decrement, i.e. `x--` is equivalent to `x = x - 1`. When this operator is used for an array index, the variable value is obtained before the auto decrement operation
| `+=` | Addition assignment operator, for example `x += 3` corresponds to `x = x + 3`
| `-=` | Subtraction assignment operator, for example `x -= 3` corresponds to `x = x - 3`
{:.conventions }
### Mathematical functions
The following mathematical functions (Abs, Min, and Max)
are defined as follows:
<script type="math/asciimath">
"Abs"(x)={[x;,x >= 0],[-x;,x<0]}
</script>
<br>
<script type="math/asciimath">
"Min"(x,y)={[x;,x<=y],[y;,x>y]}
</script>
<br>
<script type="math/asciimath">
"Max"(x,y)={[x;,x>=y],[y;,x<y]}
</script>
* The split data must be decoded before the EdgeBreaker symbols are
decoded.
### Method of describing bitstream syntax ### Method of describing bitstream syntax

BIN
docs/spec/images/attributes.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
docs/spec/images/draco_file.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB