2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-09 22:23:34 +08:00
|
|
|
https://axis-project.github.io/
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#include "lua_test_bindings.h"
|
|
|
|
#include "cocos2d.h"
|
2016-03-21 21:04:06 +08:00
|
|
|
#include "scripting/lua-bindings/manual/LuaBasicConversions.h"
|
2014-10-10 09:49:25 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BEGIN
|
2014-10-10 09:49:25 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy DrawNode for 3D geometry drawing.
|
|
|
|
*/
|
2021-12-28 16:06:23 +08:00
|
|
|
class DrawNode3D : public Node
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** creates and initialize a DrawNode3D node */
|
|
|
|
static DrawNode3D* create();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
/**
|
|
|
|
* Draw 3D Line
|
|
|
|
*/
|
2021-12-28 16:06:23 +08:00
|
|
|
void drawLine(const Vec3& from, const Vec3& to, const Color4F& color);
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
/**
|
|
|
|
* Draw 3D cube
|
|
|
|
* @param point to a vertex array who has 8 element.
|
|
|
|
* vertices[0]:Left-top-front,
|
|
|
|
* vertices[1]:Left-bottom-front,
|
|
|
|
* vertices[2]:Right-bottom-front,
|
|
|
|
* vertices[3]:Right-top-front,
|
|
|
|
* vertices[4]:Right-top-back,
|
|
|
|
* vertices[5]:Right-bottom-back,
|
|
|
|
* vertices[6]:Left-bottom-back,
|
|
|
|
* vertices[7]:Left-top-back.
|
|
|
|
* @param color
|
|
|
|
*/
|
2021-12-28 16:06:23 +08:00
|
|
|
void drawCube(Vec3* vertices, const Color4F& color);
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
/** Clear the geometry in the node's buffer. */
|
|
|
|
void clear();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
|
|
|
const BlendFunc& getBlendFunc() const;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
/**
|
|
|
|
* @code
|
|
|
|
* When this function bound into js or lua,the parameter will be changed
|
|
|
|
* In js: var setBlendFunc(var src, var dst)
|
|
|
|
* @endcode
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2021-12-28 16:06:23 +08:00
|
|
|
void setBlendFunc(const BlendFunc& blendFunc);
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
// Overrides
|
2021-12-28 16:06:23 +08:00
|
|
|
virtual void draw(Renderer* renderer, const Mat4& transform, uint32_t flags) override;
|
|
|
|
|
2022-03-18 21:46:07 +08:00
|
|
|
DrawNode3D();
|
2014-10-10 09:49:25 +08:00
|
|
|
virtual ~DrawNode3D();
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
protected:
|
|
|
|
struct V3F_C4B
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
Vec3 vertices;
|
|
|
|
Color4B colors;
|
2014-10-10 09:49:25 +08:00
|
|
|
};
|
|
|
|
void ensureCapacity(int count);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
std::vector<V3F_C4B> _buffer;
|
|
|
|
|
|
|
|
BlendFunc _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
|
|
|
CustomCommand _customCommand;
|
|
|
|
backend::ProgramState* _programState = nullptr;
|
|
|
|
bool _dirty = false;
|
|
|
|
backend::UniformLocation _locMVPMatrix;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
private:
|
2022-07-15 19:17:01 +08:00
|
|
|
AX_DISALLOW_COPY_AND_ASSIGN(DrawNode3D);
|
2019-05-05 15:26:34 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
bool _rendererDepthTestEnabled = false;
|
2019-05-05 15:26:34 +08:00
|
|
|
|
|
|
|
void onBeforeDraw();
|
|
|
|
void onAfterDraw();
|
2014-10-10 09:49:25 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
DrawNode3D::DrawNode3D() {}
|
2014-10-10 09:49:25 +08:00
|
|
|
|
|
|
|
DrawNode3D::~DrawNode3D()
|
|
|
|
{
|
2022-07-15 19:17:01 +08:00
|
|
|
AX_SAFE_RELEASE_NULL(_programState);
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DrawNode3D* DrawNode3D::create()
|
|
|
|
{
|
2021-12-08 00:11:53 +08:00
|
|
|
DrawNode3D* ret = new DrawNode3D();
|
|
|
|
if (ret->init())
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
ret->autorelease();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-15 19:17:01 +08:00
|
|
|
AX_SAFE_DELETE(ret);
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawNode3D::ensureCapacity(int count)
|
|
|
|
{
|
2022-07-16 10:43:05 +08:00
|
|
|
AXASSERT(count >= 0, "capacity must be >= 0");
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
if (_buffer.size() + count > _buffer.capacity())
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto newSize = MAX(_buffer.capacity() + (_buffer.capacity() >> 1), count + _buffer.size());
|
2019-05-05 15:26:34 +08:00
|
|
|
_buffer.reserve(newSize);
|
2021-12-28 16:06:23 +08:00
|
|
|
}
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DrawNode3D::init()
|
|
|
|
{
|
2019-05-05 15:26:34 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
|
|
|
auto program = backend::Program::getBuiltinProgram(backend::ProgramType::LINE_COLOR_3D);
|
2019-10-15 09:40:59 +08:00
|
|
|
_programState = new backend::ProgramState(program);
|
2019-05-05 15:26:34 +08:00
|
|
|
|
|
|
|
_locMVPMatrix = _programState->getUniformLocation("u_MVPMatrix");
|
|
|
|
|
|
|
|
#define INITIAL_VERTEX_BUFFER_LENGTH 512
|
|
|
|
ensureCapacity(INITIAL_VERTEX_BUFFER_LENGTH);
|
|
|
|
|
|
|
|
_customCommand.setDrawType(CustomCommand::DrawType::ARRAY);
|
|
|
|
_customCommand.setPrimitiveType(CustomCommand::PrimitiveType::LINE);
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
auto layout = _programState->getVertexLayout();
|
|
|
|
const auto& attributeInfo = _programState->getProgram()->getActiveAttributes();
|
|
|
|
auto iter = attributeInfo.find("a_position");
|
|
|
|
if (iter != attributeInfo.end())
|
|
|
|
{
|
2019-08-15 16:51:49 +08:00
|
|
|
layout->setAttribute(iter->first, iter->second.location, backend::VertexFormat::FLOAT3, 0, false);
|
2019-05-05 15:26:34 +08:00
|
|
|
}
|
|
|
|
iter = attributeInfo.find("a_color");
|
|
|
|
if (iter != attributeInfo.end())
|
|
|
|
{
|
2019-08-15 16:51:49 +08:00
|
|
|
layout->setAttribute(iter->first, iter->second.location, backend::VertexFormat::UBYTE4, sizeof(Vec3), true);
|
2019-05-05 15:26:34 +08:00
|
|
|
}
|
2019-08-15 16:51:49 +08:00
|
|
|
layout->setLayout(sizeof(V3F_C4B));
|
2019-05-05 15:26:34 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
_customCommand.createVertexBuffer(sizeof(V3F_C4B), INITIAL_VERTEX_BUFFER_LENGTH,
|
|
|
|
CustomCommand::BufferUsage::DYNAMIC);
|
2019-05-05 15:26:34 +08:00
|
|
|
|
|
|
|
_customCommand.getPipelineDescriptor().programState = _programState;
|
|
|
|
|
|
|
|
_dirty = true;
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
_customCommand.setBeforeCallback(AX_CALLBACK_0(DrawNode3D::onBeforeDraw, this));
|
|
|
|
_customCommand.setAfterCallback(AX_CALLBACK_0(DrawNode3D::onAfterDraw, this));
|
2019-05-05 15:26:34 +08:00
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
2019-05-05 15:26:34 +08:00
|
|
|
// Need to listen the event only when not use batchnode, because it will use VBO
|
2021-12-28 16:06:23 +08:00
|
|
|
auto listener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom* event) {
|
2019-05-05 15:26:34 +08:00
|
|
|
/** listen the event that coming to foreground on Android */
|
|
|
|
this->init();
|
|
|
|
});
|
|
|
|
|
|
|
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
|
|
|
#endif
|
2019-03-07 11:34:02 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void DrawNode3D::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
_customCommand.init(_globalZOrder);
|
2021-12-28 16:06:23 +08:00
|
|
|
// update mvp matrix
|
|
|
|
auto& matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
|
|
|
auto mvp = matrixP * transform;
|
2019-05-05 15:26:34 +08:00
|
|
|
_programState->setUniform(_locMVPMatrix, mvp.m, sizeof(mvp.m));
|
2014-10-10 09:49:25 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
if (_customCommand.getVertexCapacity() < _buffer.size())
|
|
|
|
{
|
2019-06-10 01:33:20 +08:00
|
|
|
auto s = _buffer.size();
|
2021-12-28 16:06:23 +08:00
|
|
|
_customCommand.createVertexBuffer(sizeof(V3F_C4B), s + s / 2, CustomCommand::BufferUsage::DYNAMIC);
|
2019-06-10 01:33:20 +08:00
|
|
|
}
|
|
|
|
|
2019-05-05 15:26:34 +08:00
|
|
|
if (_dirty && !_buffer.empty())
|
|
|
|
{
|
|
|
|
_customCommand.updateVertexBuffer(_buffer.data(), (unsigned int)(_buffer.size() * sizeof(_buffer[0])));
|
|
|
|
_customCommand.setVertexDrawInfo(0, _buffer.size());
|
|
|
|
_dirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
setBlendFunc(_blendFunc);
|
|
|
|
|
|
|
|
if (!_buffer.empty())
|
|
|
|
{
|
|
|
|
renderer->addCommand(&_customCommand);
|
|
|
|
}
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void DrawNode3D::drawLine(const Vec3& from, const Vec3& to, const Color4F& color)
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
unsigned int vertex_count = 2;
|
|
|
|
ensureCapacity(vertex_count);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
Color4B col = Color4B(color);
|
2021-12-28 16:06:23 +08:00
|
|
|
V3F_C4B a = {Vec3(from.x, from.y, from.z), col};
|
|
|
|
V3F_C4B b = {
|
|
|
|
Vec3(to.x, to.y, to.z),
|
|
|
|
col,
|
|
|
|
};
|
2019-05-05 15:26:34 +08:00
|
|
|
_buffer.emplace_back(a);
|
|
|
|
_buffer.emplace_back(b);
|
2014-10-10 09:49:25 +08:00
|
|
|
_dirty = true;
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void DrawNode3D::drawCube(Vec3* vertices, const Color4F& color)
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
// front face
|
|
|
|
drawLine(vertices[0], vertices[1], color);
|
|
|
|
drawLine(vertices[1], vertices[2], color);
|
|
|
|
drawLine(vertices[2], vertices[3], color);
|
|
|
|
drawLine(vertices[3], vertices[0], color);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
// back face
|
|
|
|
drawLine(vertices[4], vertices[5], color);
|
|
|
|
drawLine(vertices[5], vertices[6], color);
|
|
|
|
drawLine(vertices[6], vertices[7], color);
|
|
|
|
drawLine(vertices[7], vertices[4], color);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
// edge
|
|
|
|
drawLine(vertices[0], vertices[7], color);
|
|
|
|
drawLine(vertices[1], vertices[6], color);
|
|
|
|
drawLine(vertices[2], vertices[5], color);
|
|
|
|
drawLine(vertices[3], vertices[4], color);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawNode3D::clear()
|
|
|
|
{
|
|
|
|
_dirty = true;
|
2019-05-05 15:26:34 +08:00
|
|
|
_buffer.clear();
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const BlendFunc& DrawNode3D::getBlendFunc() const
|
|
|
|
{
|
|
|
|
return _blendFunc;
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void DrawNode3D::setBlendFunc(const BlendFunc& blendFunc)
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
|
|
|
_blendFunc = blendFunc;
|
2021-12-28 16:06:23 +08:00
|
|
|
// update blend mode
|
|
|
|
auto& blend = _customCommand.getPipelineDescriptor().blendDescriptor;
|
|
|
|
blend.blendEnabled = true;
|
2019-05-05 15:26:34 +08:00
|
|
|
blend.sourceRGBBlendFactor = blend.sourceAlphaBlendFactor = _blendFunc.src;
|
|
|
|
blend.destinationRGBBlendFactor = blend.destinationAlphaBlendFactor = _blendFunc.dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawNode3D::onBeforeDraw()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto* renderer = Director::getInstance()->getRenderer();
|
2019-05-05 15:26:34 +08:00
|
|
|
_rendererDepthTestEnabled = renderer->getDepthTest();
|
|
|
|
renderer->setDepthTest(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawNode3D::onAfterDraw()
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
auto* renderer = Director::getInstance()->getRenderer();
|
2019-05-05 15:26:34 +08:00
|
|
|
renderer->setDepthTest(_rendererDepthTestEnabled);
|
2014-10-10 09:49:25 +08:00
|
|
|
}
|
2014-11-13 15:36:43 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@since v3.3rc1
|
|
|
|
This class is used to check if the the value type judgement in table is correct or not.
|
|
|
|
eg:
|
|
|
|
If call `create` by passing {index1 = 111, index2 = 112, index3 = 113} from lua,
|
|
|
|
the type 111,112,113 would be judged as string type before 3.3rc1
|
|
|
|
**/
|
2021-12-28 16:06:23 +08:00
|
|
|
class ValueTypeJudgeInTable : public Node
|
2014-11-13 15:36:43 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static ValueTypeJudgeInTable* create(ValueMap valueMap);
|
|
|
|
};
|
|
|
|
|
|
|
|
ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(ValueMap valueMap)
|
|
|
|
{
|
2021-12-08 00:11:53 +08:00
|
|
|
ValueTypeJudgeInTable* ret = new ValueTypeJudgeInTable();
|
|
|
|
ret->autorelease();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
int index = 0;
|
2019-04-28 09:20:22 +08:00
|
|
|
for (const auto& iter : valueMap)
|
2014-11-13 15:36:43 +08:00
|
|
|
{
|
2021-11-09 14:29:15 +08:00
|
|
|
Value::Type type = iter.second.getTypeFamily();
|
2021-12-28 16:06:23 +08:00
|
|
|
if (type == Value::Type::STRING)
|
|
|
|
{
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("The type of index %d is string", index);
|
2014-11-13 15:36:43 +08:00
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
if (type == Value::Type::INTEGER || type == Value::Type::DOUBLE || type == Value::Type::FLOAT)
|
|
|
|
{
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("The type of index %d is number", index);
|
2014-11-13 15:36:43 +08:00
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
++index;
|
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_END
|
2014-10-10 09:49:25 +08:00
|
|
|
|
|
|
|
int lua_cocos2dx_DrawNode3D_getBlendFunc(lua_State* L)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
int argc = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* cobj = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
cobj = (axis::DrawNode3D*)tolua_tousertype(L, 1, 0);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_getBlendFunc'", nullptr);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
2014-10-10 09:49:25 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
const axis::BlendFunc& ret = cobj->getBlendFunc();
|
2014-10-10 09:49:25 +08:00
|
|
|
blendfunc_to_luaval(L, ret);
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:getBlendFunc", argc, 0);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_getBlendFunc'.", &tolua_err);
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_cocos2dx_DrawNode3D_setBlendFunc(lua_State* L)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
int argc = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* cobj = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
cobj = (axis::DrawNode3D*)tolua_tousertype(L, 1, 0);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_setBlendFunc'", nullptr);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
2015-01-14 13:51:09 +08:00
|
|
|
if (argc == 1)
|
2014-10-10 09:49:25 +08:00
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::BlendFunc arg0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_blendfunc(L, 2, &arg0, "ax.Sprite3D:setBlendFunc");
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2015-01-14 13:51:09 +08:00
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid arguments in function 'lua_cocos2dx_DrawNode3D_setBlendFunc'", nullptr);
|
2015-01-14 13:51:09 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
cobj->setBlendFunc(arg0);
|
|
|
|
return 0;
|
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:setBlendFunc", argc, 1);
|
2015-01-14 15:09:37 +08:00
|
|
|
return 0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-01-14 15:09:37 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_setBlendFunc'.", &tolua_err);
|
2015-01-14 15:09:37 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-01-14 15:09:37 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
int lua_cocos2dx_DrawNode3D_drawLine(lua_State* L)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
int argc = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* cobj = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
cobj = (axis::DrawNode3D*)tolua_tousertype(L, 1, 0);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_drawLine'", nullptr);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
2014-10-10 09:49:25 +08:00
|
|
|
if (argc == 3)
|
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Vec3 arg0;
|
|
|
|
axis::Vec3 arg1;
|
|
|
|
axis::Color4F arg2;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.DrawNode3D:drawLine");
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.DrawNode3D:drawLine");
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_color4f(L, 4, &arg2, "ax.DrawNode3D:drawLine");
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
cobj->drawLine(arg0, arg1, arg2);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawLine", argc, 3);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_drawLine'.", &tolua_err);
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_cocos2dx_DrawNode3D_clear(lua_State* L)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
int argc = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* cobj = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
cobj = (axis::DrawNode3D*)tolua_tousertype(L, 1, 0);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_clear'", nullptr);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
2014-10-10 09:49:25 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
cobj->clear();
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:clear", argc, 0);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_clear'.", &tolua_err);
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_cocos2dx_DrawNode3D_drawCube(lua_State* L)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
int argc = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* cobj = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
cobj = (axis::DrawNode3D*)tolua_tousertype(L, 1, 0);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_drawCube'", nullptr);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
2014-10-10 09:49:25 +08:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
std::vector<axis::Vec3> arg0;
|
|
|
|
axis::Color4F arg1;
|
2014-10-10 09:49:25 +08:00
|
|
|
Vec3 vec3;
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
size_t size = lua_objlen(L, 2);
|
|
|
|
for (int i = 0; i < size; i++)
|
|
|
|
{
|
|
|
|
lua_pushnumber(L, i + 1);
|
|
|
|
lua_gettable(L, 2);
|
2014-10-17 14:16:17 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2014-10-10 09:49:25 +08:00
|
|
|
if (!tolua_istable(L, -1, 0, &tolua_err))
|
|
|
|
{
|
|
|
|
lua_pop(L, 1);
|
|
|
|
goto tolua_lerror;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
ok &= luaval_to_vec3(L, lua_gettop(L), &vec3);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-17 14:16:17 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2014-10-10 09:49:25 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
lua_pop(L, 1);
|
|
|
|
goto tolua_lerror;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
// arg0[i] = vec3;
|
2014-10-10 09:49:25 +08:00
|
|
|
arg0.push_back(vec3);
|
|
|
|
lua_pop(L, 1);
|
|
|
|
}
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_color4f(L, 3, &arg1, "ax.DrawNode3D:drawCube");
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
cobj->drawCube(&arg0[0], arg1);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawCube", argc, 2);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_drawCube'.", &tolua_err);
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_cocos2dx_DrawNode3D_create(lua_State* L)
|
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
bool ok = true;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertable(L, 1, "ax.DrawNode3D", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::DrawNode3D* ret = axis::DrawNode3D::create();
|
2022-07-12 21:31:54 +08:00
|
|
|
object_to_luaval<axis::DrawNode3D>(L, "ax.DrawNode3D", (axis::DrawNode3D*)ret);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.DrawNode3D:create", argc, 0);
|
2014-10-10 09:49:25 +08:00
|
|
|
return 0;
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_DrawNode3D_create'.", &tolua_err);
|
2014-10-10 09:49:25 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_register_cocos2dx_DrawNode3D(lua_State* L)
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_usertype(L, "ax.DrawNode3D");
|
|
|
|
tolua_cclass(L, "DrawNode3D", "ax.DrawNode3D", "ax.Node", nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
tolua_beginmodule(L, "DrawNode3D");
|
|
|
|
tolua_function(L, "getBlendFunc", lua_cocos2dx_DrawNode3D_getBlendFunc);
|
|
|
|
tolua_function(L, "drawLine", lua_cocos2dx_DrawNode3D_drawLine);
|
|
|
|
tolua_function(L, "clear", lua_cocos2dx_DrawNode3D_clear);
|
|
|
|
tolua_function(L, "drawCube", lua_cocos2dx_DrawNode3D_drawCube);
|
|
|
|
tolua_function(L, "create", lua_cocos2dx_DrawNode3D_create);
|
2014-10-10 09:49:25 +08:00
|
|
|
tolua_endmodule(L);
|
2022-07-11 17:50:21 +08:00
|
|
|
auto typeName = typeid(axis::DrawNode3D).name();
|
2022-07-12 21:31:54 +08:00
|
|
|
g_luaType[reinterpret_cast<uintptr_t>(typeName)] = "ax.DrawNode3D";
|
|
|
|
g_typeCast[typeName] = "ax.DrawNode3D";
|
2014-10-10 09:49:25 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
int lua_cocos2dx_ValueTypeJudgeInTable_create(lua_State* L)
|
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
bool ok = true;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
#if COCOS2D_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertable(L, 1, "ax.ValueTypeJudgeInTable", 0, &tolua_err))
|
2021-12-28 16:06:23 +08:00
|
|
|
goto tolua_lerror;
|
2014-11-13 15:36:43 +08:00
|
|
|
#endif
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-11-13 15:36:43 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ValueMap arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_ccvaluemap(L, 2, &arg0, "ax.ValueTypeJudgeInTable:create");
|
2021-12-28 16:06:23 +08:00
|
|
|
if (!ok)
|
2014-11-13 15:36:43 +08:00
|
|
|
return 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::ValueTypeJudgeInTable* ret = axis::ValueTypeJudgeInTable::create(arg0);
|
2022-07-12 21:31:54 +08:00
|
|
|
object_to_luaval<axis::ValueTypeJudgeInTable>(L, "ax.ValueTypeJudgeInTable",
|
2022-07-11 17:50:21 +08:00
|
|
|
(axis::ValueTypeJudgeInTable*)ret);
|
2014-11-13 15:36:43 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AXLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.ValueTypeJudgeInTable:create", argc, 1);
|
2014-11-13 15:36:43 +08:00
|
|
|
return 0;
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2021-12-28 16:06:23 +08:00
|
|
|
tolua_error(L, "#ferror in function 'lua_cocos2dx_ValueTypeJudgeInTable_create'.", &tolua_err);
|
2014-11-13 15:36:43 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lua_register_cocos2dx_ValueTypeJudgeInTable(lua_State* L)
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_usertype(L, "ax.ValueTypeJudgeInTable");
|
|
|
|
tolua_cclass(L, "ValueTypeJudgeInTable", "ax.ValueTypeJudgeInTable", "ax.Node", nullptr);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
tolua_beginmodule(L, "ValueTypeJudgeInTable");
|
|
|
|
tolua_function(L, "create", lua_cocos2dx_ValueTypeJudgeInTable_create);
|
2014-11-13 15:36:43 +08:00
|
|
|
tolua_endmodule(L);
|
2022-07-11 17:50:21 +08:00
|
|
|
auto typeName = typeid(axis::ValueTypeJudgeInTable).name();
|
2022-07-12 21:31:54 +08:00
|
|
|
g_luaType[reinterpret_cast<uintptr_t>(typeName)] = "ax.ValueTypeJudgeInTable";
|
|
|
|
g_typeCast[typeName] = "ax.ValueTypeJudgeInTable";
|
2014-11-13 15:36:43 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-10-10 09:49:25 +08:00
|
|
|
int register_test_binding(lua_State* L)
|
|
|
|
{
|
|
|
|
tolua_open(L);
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_module(L, "ax", 0);
|
|
|
|
tolua_beginmodule(L, "ax");
|
2021-12-28 16:06:23 +08:00
|
|
|
lua_register_cocos2dx_DrawNode3D(L);
|
|
|
|
lua_register_cocos2dx_ValueTypeJudgeInTable(L);
|
2014-10-10 09:49:25 +08:00
|
|
|
tolua_endmodule(L);
|
|
|
|
return 0;
|
|
|
|
}
|