| 597 | // Light |
| 598 | |
| 599 | void SceneCache::writeLight(OutputStream& stream, const ref<Light>& pLight) |
| 600 | { |
| 601 | LightType type = pLight->getType(); |
| 602 | stream.write(type); |
| 603 | |
| 604 | stream.write(pLight->mHasAnimation); |
| 605 | stream.write(pLight->mIsAnimated); |
| 606 | stream.write(pLight->mNodeID); |
| 607 | |
| 608 | stream.write(pLight->mName); |
| 609 | stream.write(pLight->mActive); |
| 610 | stream.write(pLight->mData); |
| 611 | |
| 612 | switch (type) |
| 613 | { |
| 614 | case LightType::Point: |
| 615 | case LightType::Directional: |
| 616 | break; |
| 617 | case LightType::Distant: |
| 618 | stream.write(static_ref_cast<DistantLight>(pLight)->mAngle); |
| 619 | break; |
| 620 | case LightType::Rect: |
| 621 | case LightType::Disc: |
| 622 | case LightType::Sphere: |
| 623 | stream.write(static_ref_cast<AnalyticAreaLight>(pLight)->mScaling); |
| 624 | stream.write(static_ref_cast<AnalyticAreaLight>(pLight)->mTransformMatrix); |
| 625 | break; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | ref<Light> SceneCache::readLight(InputStream& stream) |
| 630 | { |