Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Basic Voxel Class
SUBMITTED BY:
Guest
DATE:
April 24, 2013, 6:52 p.m.
FORMAT:
C++
SIZE:
1.1 kB
Raw
Download
Tweet
HITS:
1217
Go to comments
Report
//
// Okzoniom::RPG
// Copyright (C) 2010 - 2013
//
// - Louis SCHNELLBACH
//
#ifndef VOXEL_H_INCLUDED
#define VOXEL_H_INCLUDED
class
Voxel
{
protected
:
uint8_t
data
=
0
;
/**
* Bits and usages
* 7 :
* 6 :
* 5 :
* 4 :
* 3 : Type
* 2 : Type
* 1 : Type
* 0 : Active / Inactive
**/
/**
* Type value
* 0 : None (Whatever color / information it can take)
* 1 : Water
* 2 : Sand
* 3 : Grass
* 4 : Rock
* 5 :
* 6 :
**/
public
:
enum
Modifier
{
GET
=
0
,
SET
=
1
};
bool
active
(
Modifier
m
=
GET
,
bool
value
=
false
)
{
if
(
m
==
SET
)
data
=
(
0xFE
|
value
);
return
data
&
0x1
;
}
uint8_t
type
(
Modifier
m
=
GET
,
uint8_t
value
=
0x7
)
{
if
(
m
==
SET
)
data
=
(
0xF1
|
(
value
<<
1
));
return
(
data
&
0xE
)
>>
1
;
}
};
#endif
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus