/
Zamar_Terrier
/
TigorEngine
Обзор
Документация
Войти
/
Zamar_Terrier
/
TigorEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tests/render_offscreen.c
91 строка
3 KB
Zamar_Terrier
Офигенное обновление движка
31 июл 2026, 21:03
Верифицирован
31 июл 2026, 21:03
1682686
Код
Авторство
О чём код?
#include <TigorEngine.h> #include <vulkan/vulkan.h> #include <Core/e_camera.h> #include <Core/e_blue_print.h> #include <Core/graphicsObject.h> #include <Objects/gameObject2D.h> #include <Objects/shape_object.h> #include <Objects/render_texture.h> #include <Objects/primitiveObject.h> #include <Core/e_buffer.h> #include <stb_image_write.h> ShapeObject shape; ShapeObject shape2; PrimitiveObject po; PrimitiveObject po2; RenderTexture scene_buffer; void Update(float dTime){ double xpos, ypos; TEngineGetCursorPos(&xpos, &ypos); //Transform2DSetPosition((GameObject2D *)&shape, xpos, ypos); Camera3DRotationUpdate(&scene_buffer.cam3D, dTime); } uint32_t ticker = 0; void Draw(){ GameObjectDraw((GameObject *)&po); GameObjectDraw((GameObject *)&po2); GameObjectDraw((GameObject *)&shape); GameObjectDraw((GameObject *)&shape2); } int main(){ TEngineInitSystem(800, 600, "OffScreen"); TEngineSetDrawer(Draw); TEngineSetUpdater(Update); RenderTextureInit(&scene_buffer, TIGOR_RENDER_TYPE_COLORED_IMAGE, 800, 600, 0); ShapeObjectInit(&shape, NULL, TIGOR_SHAPE_OBJECT_QUAD, NULL); GameObject2DInitDefaultShaderWithName((GameObject2D *)&shape, "2DDefault"); GameObject2DSetDescriptorUpdate((GameObject2D *)&shape, 0, 0, (UpdateDescriptor)GameObject2DTransformBufferUpdate); GameObject2DSetDescriptorUpdate((GameObject2D *)&shape, 0, 1, (UpdateDescriptor)GameObject2DImageBuffer); BluePrintAddRenderImage(&shape.go.graphObj.BluePrints, 0, &scene_buffer, 2); Transform2DSetScale((GameObject2D *)&shape, 100, 76.9f); Transform2DSetPosition((GameObject2D *)&shape, 200, 200); PrimitiveObjectInit(&po, NULL, TIGOR_PRIMITIVE3D_CUBE, NULL); GameObject3DSetRender((GameObject3D *)&po, &scene_buffer); Transform3DSetPosition((GameObject3D *)&po, 0, 0, -5); PrimitiveObjectInit(&po2, NULL, TIGOR_PRIMITIVE3D_CUBE, NULL); Transform3DSetPosition((GameObject3D *)&po2, 0, 0, -5); ShapeObjectInit(&shape2, NULL, TIGOR_SHAPE_OBJECT_QUAD, NULL); GameObject2DInitDefaultShader((GameObject2D *) &shape2); GameObject2DSetRender((GameObject2D *)&shape2, &scene_buffer); Transform2DSetScale((GameObject2D *)&shape2, 100, 100); Transform2DSetPosition((GameObject2D *)&shape2, 200, 200); TEngineSetRender(&scene_buffer, 1); TEngineStartRender(); GameObjectDestroy((GameObject *)&shape); GameObjectDestroy((GameObject *)&shape2); GameObjectDestroy((GameObject *)&po); GameObjectDestroy((GameObject *)&po2); TEngineCleanUp(); return 0; }