LCOV - code coverage report
Current view: top level - xenolith/renderer/basic2d - XL2dSceneLight.cc (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 37 43.2 %
Date: 2024-05-12 00:16:13 Functions: 3 9 33.3 %

          Line data    Source code
       1             : /**
       2             :  Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
       3             : 
       4             :  Permission is hereby granted, free of charge, to any person obtaining a copy
       5             :  of this software and associated documentation files (the "Software"), to deal
       6             :  in the Software without restriction, including without limitation the rights
       7             :  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       8             :  copies of the Software, and to permit persons to whom the Software is
       9             :  furnished to do so, subject to the following conditions:
      10             : 
      11             :  The above copyright notice and this permission notice shall be included in
      12             :  all copies or substantial portions of the Software.
      13             : 
      14             :  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      15             :  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      16             :  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      17             :  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      18             :  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      19             :  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      20             :  THE SOFTWARE.
      21             :  **/
      22             : 
      23             : #include "XL2dSceneLight.h"
      24             : #include "XL2dScene.h"
      25             : 
      26             : namespace STAPPLER_VERSIONIZED stappler::xenolith::basic2d {
      27             : 
      28           0 : bool SceneLight::init(SceneLightType type, const Vec4 &normal, const Color4F &color, const Vec4 &data) {
      29           0 :         _type = type;
      30           0 :         _normal = normal;
      31           0 :         _color = color;
      32           0 :         _data = data;
      33           0 :         return true;
      34             : }
      35             : 
      36          20 : bool SceneLight::init(SceneLightType type, const Vec2 &normal, float k, const Color4F &color, const Vec4 &data) {
      37          20 :         _type = type;
      38          20 :         _enable2dNormal = true;
      39          20 :         _2dNormal = normal;
      40          20 :         _k = k;
      41          20 :         _color = color;
      42          20 :         _data = data;
      43          20 :         return true;
      44             : }
      45             : 
      46          20 : void SceneLight::onEnter(Scene *scene) {
      47          20 :         if (_enable2dNormal) {
      48          20 :                 _normal = Vec4(Vec3(_2dNormal.x, _2dNormal.y, 1.0f).normalize(), _k);
      49             :         }
      50             : 
      51          20 :         _running = true;
      52          20 : }
      53             : 
      54          20 : void SceneLight::onExit() {
      55          20 :         _running = false;
      56          20 : }
      57             : 
      58           0 : void SceneLight::setNormal(const Vec4 &vec) {
      59           0 :         _normal = vec;
      60           0 : }
      61             : 
      62           0 : void SceneLight::setColor(const Color4F &color) {
      63           0 :         _color = color;
      64           0 : }
      65             : 
      66           0 : void SceneLight::setData(const Vec4 &data) {
      67           0 :         _data = data;
      68           0 : }
      69             : 
      70           0 : void SceneLight::setName(StringView str) {
      71           0 :         _name = str.str<Interface>();
      72           0 : }
      73             : 
      74           0 : void SceneLight::setTag(uint64_t tag) {
      75           0 :         _tag = tag;
      76           0 : }
      77             : 
      78             : }

Generated by: LCOV version 1.14