Activity for Michalis Kamburelis

  • Michalis Kamburelis Michalis Kamburelis created ticket #3

    Missing DLLs (msvcp140.dll, likely also vcruntime140.dll) upon installing FreeWRL on fresh Windows 11 installation

  • Michalis Kamburelis Michalis Kamburelis posted a comment on ticket #92

    Thank you for the report. Indeed I can reproduce the problem with latest PasDoc. We don't use SourceForge bugtracker anymore, we now use GitHub issue tracker on https://github.com/pasdoc/pasdoc/issues/ . I have added an issue, with a copy of your description and a testcase, to https://github.com/pasdoc/pasdoc/issues/92 (you can registeron GitHub and "Subscribe" to that issue).

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    [offtopic] Today, we officialy move to a new forum on https://forum.castle-engine.io/ . It's more functional and beautiful! :) This forum (with all the topics) will stay available for a while (to allow people to search old topics -- we cannot import them). But please post all new topics on a new forum :) If you want to post replies to the existing topic on this forum, use whatever you prefer --- you can create a new topic on a new forum, or you can post in this forum (henceforth called "old foru...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Way cool! Thanks for creating this. I'll announce it on CGE news soon. I submitted a small pull request to allow running it under Linux too, https://github.com/valterb/sprite-demo-castle-engine/pull/1 :)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    This is the same bug that was submitted to https://github.com/castle-engine/view3dscene/issues/10 . I simply did not have the time to handle it yet. It seems that 2 days ago the reporter deleted the description of the bug on GitHub (but it is still visible if you click on "edited by ghost" in that bug-report), and then closed it. I have reopened the bug-report on https://github.com/castle-engine/view3dscene/issues/10 . See my comments in the bug-report. In short: 1. Thank you for reporting! 2. But...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    When animating using TSprite, you have to implement such thing yourself. You need to track the list of animations you want to play, and when one finishes -- start the next one. The current animation time is in TSprite.Duration (in seconds), and you can track passing seconds using SecondPassed parameter of various OnUpdate events, like Window.OnUpdate. ( If using sprites through TCastleScene, there are more options, it has a Play method with optional play parameters where you can specify a callback...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Right now there will not be a speed difference in how we render two different shapes with a refence to the same TCoordinateNode node. This may change some day! Still, as Eugene writes, you will have better memory (RAM) usage in case you use the same TCoordinateNode many times. This gain can be very significant in larger scenes / with lots of sharing, so I would encourage to share TCoordinateNode instances where possible :) Eventually, it can also lead to better speed of some operations, since your...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    This is very cool! Thanks for making this application. I will make a news post about it soon. 2 comments about running applications: Instead of ShellExecute (which is Windows-only), you can use RunCommand or ExecuteProcess (simple) or TProcess class (complicated, but very flexible). Their details are documented on http://wiki.freepascal.org/Executing_External_Programs . They are cross-platform, i.e. will work on Linux, macOS etc. too. In case of this application, I would actually encourage you to...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on ticket #60

    I agree, @link(Two.a) should also work eventually :)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on ticket #59

    I would prefer to fix it with @excludeBegin and @excludeEnd options, already planned. They cover more use-cases, and also would satisfy this one. You would be able to write e.g. { @excludeBegin } {$I myinclude.inc} { @excludeEnd } to have everything inside your include file ignored. You could also place the @excludeBegin/End inside the myinclude.inc file.

  • Michalis Kamburelis Michalis Kamburelis posted a comment on ticket #60

    The @link should lead to @link(TRecord2.a), not @link(Two.a). In order to link to TRecord2.a but show it as Two.a, you can write @link(TRecord2.a Two.a), see https://github.com/pasdoc/pasdoc/wiki/LinkTag . That said, indeed it isn't working with the nested record as it should. I'm attaching a testcase I made, based on your code, and indeed it uncovers two situations that don't work as they should. The problem is most likely in PasDoc's TPasItem.FindNameWithinUnit method -- it's way too simple :),...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    To add to Eugene's answer: If you later change the contents of TCastleImage, you can call MyImage.Load(CastleImage) to refresh the displayed image contents. E.g. you can do CastleImage.FlipHorizontal and then call MyImage.Load(CastleImage) to make the displayed image reflect the new (flipped) contents of CastleImage. Note that one can also flip the image at zero-cost using TGLImage.DrawFlipped, used also by TSprite.HorizontalFlip. But this does not flip the underlying image contents, so it is not...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    To add to Eugene's answer: If you later change the contents of TCastleImage, you can call MyImage.Load(CastleImage) to refresh the displayed image contents. E.g. you can do CastleImage.FlipHorizontal and then call MyImage.Load(CastleImage) to make the displayed image reflect the new (flipped) contents of CastleImage. Note that one can also flip the image at zero-cost using TGLImage.DrawFlipped, used also by TSprite.HorizontalFlip. But this does not flip the underlying image contents, so it is not...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I'm happy it works now:) "Deferring" the creation of Player this way is correct... But possibly not necessary, if your first OnRender / OnUpdate will create it anyway. In the usual case it's easier to perform the initialization (like creation of Player) at one place. If you use Lazarus TForm, you can e.g. use TForm.OnCreate or CastleControl1.OnOpen. P.S. If you need to hide/show the player, you can also define a Boolean field like Visible in your TPlayer class, and only call TSprite.Draw when it's...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hm, your code (with OnUpdate handled) should work. I do not see any error there. Please submit a complete example (code (pas and lfm) and data), then I should be able to help more:) Or, you can try testing and adjusting the code in https://github.com/castle-engine/castle-engine/tree/master/examples/sprite_sheets/sprite_sheet_animation , which is tested.

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You already guessed the solution:) When using TSprite you need to call TSprite.Update to keep advancing the time. In the most common case, you do this from OnUpdate event (of TCastleControl or TCastleWindow or any TCastleUserInterface or other classes). The example https://github.com/castle-engine/castle-engine/blob/master/examples/sprite_sheets/sprite_sheet_animation/sprite_sheet_animation.lpr shows this (although it uses TCastleWindow instead of TCastleControl, but the events and logic are the...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Thanks for taking care of this! I committed new LPI files from Eugene in https://github.com/castle-engine/castle-engine/commit/9e87ca8ac0ab72e515567a2bbcd807492d247b24 .

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hi! Thanks for the good words about the engine :) Indeed only the "Empty" project template is for now available. I want to add the rest of the templates before the official engine 6.6 release. IOW, this is simply unfinished part of the CGE Editor for now. P.S. Delphi compatibility wil come in 2019 definitely! :)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    See also news on https://castle-engine.io/wp/2018/11/27/november-engine-features-part-4-castlesettings-xml-dpi-scaling-cleaner-component-palette/

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    Sorry for taking so long to answer! I run your code on my system and experimented. You're not doing anything unoptimal in your OnRender event, so my hyphotesis ("jerkiness is caused by something slowing the engine") was incorrect. I see stable FPS = 60 in your game. You can test FPS yourself, just add UIFont.Print(100, 100, Yellow, 'FPS: ' + CastleControl1.Container.Fps.ToString); at the end of CastleControl1Render call. (Be sure to also add CastleControls unit to the uses clause, to have UIFont...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Sorry for taking so long to answer! I run your code on my system and experimented. You're not doing anything unoptimal in your OnRender event, so my hyphotesis ("jerkiness is caused by something slowing the engine") was incorrect. I see stable FPS = 60 in your game. You can test FPS yourself, just add delphi UIFont.Print(100, 100, Yellow, 'FPS: ' + CastleControl1.Container.Fps.ToString); at the end of CastleControl1Render call. (Be sure to also add CastleControls unit to the uses clause, to have...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    If you still experience this problem, Make a minimal example that reproduces the problem. Remove as much as possible parts of the program, as long as the problem is still reproducible. This will make it easier for me to point out the source of trouble, and this process may also show you to the culprit and then you will not need our help to solve it:) If, after making a minimal version of the game that reproduces the problem, you prefer to send it to me privately, go ahead of course :) You can simply...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    First of all, thank you for preparing the videos. This makes it clearer what is the problem, at least what are the symptoms :) As for "optimal FPS": The very idea of using sprite-based animation is that you have discrete frames. That is an unavoidable feature of using a prepared set of still images (in sprite sheet or not) for animation. However, with sufficiently large TSprite.FramesPerSecond and with sufficiently large display FPS (by default), the movement should be smooth enough. I would not...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Eugene: Thanks for the demo! Yeah, this shows that the sorting approach should work:) As for using "nothing / Sign / Round" in CompareSprites: In short, you should really use Sign, as in my example :) With Castle Game Engine 6.4, the TSprite.Y is an Integer. So both Left.Y - Right.Y and Sign(Left.Y - Right.Y) would work, with the same effect. With Castle Game Engine >= 6.5, TSprite.Y is a Single, and you need to use Sign(). Sign is trivial mathematical function: return -1 if argument < 0.0, otherwise...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion Vote

    VOTE: freepascal

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion Vote

    VOTE:

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    The only potential problem I see in your code is that you should not use Round() on something based on SecondsPassed. So do not do Round(SecondsPassed * 200.0). Instead, get the latest CGE version from GitHub https://github.com/castle-engine/castle-engine/ where TSprite.Y has type Single and you will be able to simply do Player.CurrentSprite.X := Player.CurrentSprite.X - SecondsPassed * 200.0; instead of Player.CurrentSprite.X := Player.CurrentSprite.X - Round(SecondsPassed * 200.0); Why? The results...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The only potential problem I see in your code is that you should not use Round() on something based on SecondsPassed. So do not do Round(SecondsPassed * 200.0). Instead, get the latest CGE version from GitHub https://github.com/castle-engine/castle-engine/ where TSprite.Y has type Single and you will be able to simply do Player.CurrentSprite.X := Player.CurrentSprite.X - SecondsPassed * 200.0; instead of Player.CurrentSprite.X := Player.CurrentSprite.X - Round(SecondsPassed * 200.0); Why? The results...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Note that you may also consider creating a list with other classes, that contain TSprite. I write this, because I see that you "access" a property "Rect" of Player and Npc[Xxx] later. If your Player and NPC[1] and NPC[2] are the same classes (or descend from a common class), like TMovingCreature, then you can make a TObjectList that contains them. That is, make specialize TObjectList<TMovingCreature> instead of specialize TObjectList<TSprite>. This way each element of the list would have a property...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You made a number of mistakes in your code. I advice that you read a book about classes in Pascal. There are a number of good books, google about "pascal language classes" also finds some online resources. E.g. https://www.tutorialspoint.com/pascal/pascal_classes.htm or https://en.wikibooks.org/wiki/Pascal_Programming/Object_oriented . My own book https://castle-engine.io/modern_pascal_introduction.html may also be useful, but at a later stage. I do not explain in my book that classes are references,...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    If you use non-generic TObjectList from the Contnrs unit, it's Sort method is documented here (it is in ancestor TList actually): https://www.freepascal.org/docs-html/rtl/classes/tlist.sort.html A simple example how to use it (modified example from https://stackoverflow.com/questions/47447826/sorting-old-contnrs-tobjectlist-on-win64 ): uses Contnrs, Math, ...; function CompareSprites(Left, Right: Pointer): Integer; begin Result := Sign(TSprite(Left).Y - TSprite(Right).Y); end; procedure SortItems;...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hm, I do not understand the problem with "shaky legs". I mean, from your description, I am not sure how does the problem look like :) Maybe you have vertical synchronization disabled? This would cause an artifact like "screen tearing" when rendering. If this is the case: you can control it in your graphic card settings, in your "Control Panel" or such. Turn on "vertical synch" or "V-sync". As for updates: Note that the OnUpdate does not occur at fixed time intervals. You should multiply everything...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You can simply change DrawingWidth, DrawingHeight before each Draw call. Or use Draw overloaded version that takes explicit ScreenRectangle or DrawWidth, DrawHeight: Single parameters. Like this: procedure DrawSprite(const Sprite: TSprite; const X, Y: Single); var Scale: Single; ScreenRect: TFloatRectangle; begin // this function maps Y positions in [0..100] range to scale [1.0...0.5]. Of course substitute this with any function you want. Scale := MapRange(Y, 0, 100, 1.0, 0.5); ScreenRect := FloatRectangle(X,...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The demo examples/fonts/font_from_texture.lpr creates a number of instances of TCastleFont class (both TTextureFont and TSimpleTextureFont descend from TCastleFont). The idea is that you can assign an instance of TCastleFont to TCastleLabel.CustomFont (and this is what font_from_texture.lpr is doing), but you can also implement OnRender callback where you call TCastleFront.Print, to directly write it. Here's a simple example: https://gist.github.com/michaliskambi/117a0cda2a3ebf0a3dfa3dff5269724d

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Read the comment at the beginning of each example to know what it does :) At the beginning of "examples/fonts/font_draw_over_image.lpr" the comment says: """ ... Running this program will generate file font_draw_over_image_output.png in the current directory where the text is drawn. ... """ And this is what should happen. The program exits after creating an image file, this is it's purpose. Open the file font_draw_over_image_output.png to see the result. If you wanted to see an interactive example...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You need to install FreeType library on your system. In case of Windows, you want to place freetype DLL (and some other DLLs) in the exe directory of your application. See the section "Install the libraries" on the "Getting started" page, https://castle-engine.io/documentation.php#section_libraries .

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    MousePosition can be used to set sprite position, if you have 1. full-screen scene manager, and 2. do not use UI scaling. Both of these are default. So the example code you show is OK, but you probably want to perform this at a different event. There are various engine events, e.g.: Do it in CastleControl1.OnMotion event to do something each time mouse moves. Do it in CastleControl1.OnPress event (and check Event.IsMouseButton(mbLeft)) to do something each time left mouse button is pressed. In each...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I think you can simply add an else? :) if CastleControl1.Pressed[K_Right] then begin if Player.CurrentSprite = Player.StandRightSprite then begin ... end else // additional else here if Player.CurrentSprite = Player.WalkRightSprite then begin ... end; end; An alternative, possibly more flexible for the future and other keys, is to store at the beginning the Player.CurrentSprite value to a local variable: var PreviousSprite: TSprite; begin PreviousSprite := Player.CurrentSprite; if CastleControl1.Pressed[K_Right]...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You should load everything you need before the game, to make the game run smooth. That said, you don't have to load everything in Form.OnCreate. If you really have that many files ("hundredths of MB"), you can think about a different strategy. E.g. load only the characters/sprites needed for the current "level" (if your game has a concept of levels), before each level is loaded. IOW, there are solutions, but the exact solution depends on your game :)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    It is best to not load files (or do any other time-consuming things) in reaction to user pressing a key. You should move initialization like Player.Sprite := TSprite.CreateFrameSize ('I:\JohnWalkRight.png',12, 6, 590, 950,true, true); Player.Sprite.FramesPerSecond:= 12; Player.WalkRight := Player.Sprite.AddAnimation([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); to the initialization section of your game (Application.OnInitialize if you create cross-platform application, https://castle-engine.io/manual_cross_platform.php...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I cannot find the Sprite.Color property? Oh, I forgot that TSprite.Color was added after the last stable release, 6.4. You need to use CGE version from GitHub ( https://github.com/castle-engine/castle-engine/ ) for this. Go ahead, it's actually quite stable now :) It will become the next stable 6.6 release of course. TSprite.Color is documented in the "unstable" API docs, on https://castle-engine.io/apidoc-unstable/html/CastleGLImages.TSprite.html .

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You can use TSprite.Color property to modulate the sprite color. It a 4D vector (red, green, blue, opacity) that is multiplied component-wise by every pixel when drawing. So e.g. Sprite.Color := Vector4(0.5, 0.5, 0.5, 1) will make the sprite darker. Changing this property is "cheap", so you can even adjust Sprite.Color before every Sprite.Draw(..) call. (As for the number of colors -- 24 bit depth, 256 colors -- note that the image format doesn't matter for the engine. OpenGL works using "true color",...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    For the engine, a sprite is rendered as just a rectangle with an image. We do not analyze the image contents, we simply pass it to GPU. Analyzing would be slow:) To account for transparent pixels during collisions, you would need your own logic to handle that. You could do it in theory (you can load image to TCastleImage and read pixels alpha values), but it sounds quite non-trivial in a general case, so I would not advice that. One simple workaround is to use smaller rectangle for collisions. E.g....

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hi! In general: if you make a 2D game, I always recommend reading https://github.com/castle-engine/castle-engine/wiki/2D-Games . It has a lot of links to important concepts :) As for the rendering order ("what is displayed in front of what"): If you use TSprite class, you have to explicitly call TSprite.Draw to draw it. Whatever is rendered later, is drawn on top. E.g. here Sprite2 is in front: Sprite1.Draw(...); Sprite2.Draw(...); and here Sprite1 is in front: Sprite2.Draw(...); Sprite1.Draw(...);...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hi! As for OpenGL 4: We support OpenGL >= 4 in the sense that our headers (actually FPC headers - GL, GLExt) support OpenGL 4.0 functions. We could use new OpenGL 4.0 functions (conditionally, if our GLFeature.Version_4_0 is true -- as we also want to work with older OpenGL implementations that don't support 4.0 API yet). It's just that, in practice, for now, we didn't need any of these functions from OpenGL 4. But it is possible:) For later OpenGL versions (4.1 and so on), we would need to add the...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I do not know your exact use-case, but note that if you don't use perspective, and you simply want a 2D game, then you don't need to use Billboard node at all :) Just use TCastle2DSceneManager that creates an orthogonal projection (typically best for 2D). Inside it, add TCastle2DScene instances (with anything, like quads) that are flat (each quad has the Z coordinate equal). The Z-buffer works as usual in 2D games. Things further away (with larger Z) are behind things that are near. See https://github.com/castle-engine/castle-engine/wiki/2D-Games...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    We have a lot of optimization hints on https://castle-engine.io/manual_optimization.php :) In particular, note that If you will create a huge number of very small shapes, then the application will be slow indeed. Billboards or not billboards. The solution is to create larger shapes, composed from many quads. It may be problematic if you want all of the shapes to be billboards. Various optimizations are possible. One could indeed rotate the quads in shaders, but it would require passing additional...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    . So I will try, I hope that geom bills will be fast enough...If not... There are shader billboards also, can I use them? Hm, I'm afraid I don't understand your terminilogy here. Everything that you render is a geometry (this is true for both Castle Game Engine and all other engines). And everything is rendered using shaders (on modern GPU). If by "shader billboards" you mean a billboard that is rotated (to be oriented toward camera) on shaders: you can use custom shaders in CGE, so it is possible....

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You can place whatever you want inside a billboard. It can be a part of the texture on a quad (thus you can place there a sprite, you can even generate it with our tool sprite-sheet-to-x3d ). Everything is some geometry, in any case:)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    To create flat geometry, use various nodes from https://castle-engine.io/x3d_implementation_geometry3d.php or https://castle-engine.io/x3d_implementation_geometry2d.php . There are examples as X3D nodes, and examples as Pascal code. Use IndexedFaceSet, or QuadSet, or Rectangle2D... many choices, they all can be flat. To make them billboards (automatically oriented toward the viewer), place them as children of TBillboardNode. See e.g. how https://github.com/castle-engine/wyrd-forest/blob/master/code/gametext3d.pas...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    (While I don't know which approach Eugene had in mind, I can answer what Castle Game Engine can do:) ) Both approaches are possible with Castle Game Engine --- you can either keep the vertexes constant, and update only coordIndex, or you can update both vertexes and their indexes. An example of creating IndexedFaceSet by code is on https://castle-engine.io/x3d_implementation_geometry3d.php . In AD 1, you would repeat the call Faces.SetCoordIndex([...]) often. In AD 2, you would repeat the calls to...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    (While I don't know which approach Eugene had in mind, I can answer what Castle Game Engine can do:) ) Both approaches are possible with Castle Game Engine --- you can either keep the vertexes constant, and update only coordIndex, or you can update both vertexes and their indexes. An example of creating IndexedFaceSet by code is on https://castle-engine.io/x3d_implementation_geometry3d.php . In AD 1, you would repeat the call Faces.SetTexCoordIndex([...]) often. In AD 2, you would repeat the calls...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    If you'd like to play with it, you're very much welcome and I will help of course :) Head to https://castle-engine.io/ , download the engine, go through "getting started" ( https://castle-engine.io/documentation.php ) and read a couple of first manual pages ( https://castle-engine.io/manual_intro.php ). The first 4 chapters (up to and including "Transform, animate, duplicate, build a scene") are enough to understand how to use and modify 3D scene. The engine includes numerous samples that are a good...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    This feature is beyond the purpose of view3dscene. But it is definitely possible to code such application using Castle Game Engine, https://castle-engine.io/ , which lies underneath view3dscene :) The engine gives you API to load the scene and edit it as you wish. You can of course open a TCP connection and accept instructions from the other end and call appropriate CGE methods in return. As for the difficulty: This can be a very difficult or a very simple task... it depends on the details :) If...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Fixed! Thanks for reporting, there were 2 problems internally occurring on macOS related to this situation:) I have uploaded a version with the fix to http://michalis.ii.uni.wroc.pl/view3dscene-snapshots/macosx/ , please check it out :) Besides the fix, it includes also some other improvements since the last view3dscene and Castle Game Engine stable release :) If you want to compile from source, the fix is also committed to the GitHub of Castle Game Engine and view3dscene ( https://github.com/castle-engine/castle-engine/...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Sure! To display a 3D box, you use a TCastleScene class. You can load there a mesh created in any 3D software (like Blender), which can be as simple as a box. Or you can load there a box using TBoxNode primitive. How to display a scene, how to move it, how to load there 3D models from file or TBoxNode is described in the initial pages of the manual https://castle-engine.io/manual_intro.php . In particular see https://castle-engine.io/manual_load_3d.php , https://castle-engine.io/manual_scene.php...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    You should download https://raw.githubusercontent.com/castle-engine/cge-blender/master/export_castle_anim_frames.py . That is, save the file there (it starts with line # ##### BEGIN GPL LICENSE BLOCK #####) under the name export_castle_anim_frames.py anywhere on your disk. If you just click on the above link and do File->Save (Ctrl + S) in your WWW browser --- it will probably do it. Then follow the instructions from https://castle-engine.io/creating_data_blender.php , using "File -> User Preferences...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    P.S. The task of communicating between Pascal program and Python (using SimpleIPC or otherwise) is in general outside of the scope of Castle Game Engine. I'm not the author of SimpleIPC, so I will not be able to answer the questions about it perfectly :) The FPC mailing lists ( https://freepascal.org/maillist.var , in particular fpc-pascal) is probably better, if you will have questions about SimpleIPC or communicating with Python. The authors of SimpleIPC are listening there. There is also Lazarus...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Is it possible to select a point and then show it's 3D coördinates ? We have a support for picking 3D stuff with "area" (like triangles, and shapes they belong too, and scenes they belong to) in the 3D world. See e.g. https://github.com/castle-engine/castle-engine/blob/master/examples/3d_rendering_processing/detect_scene_clicks.lpr and comments inside. However, you have a set of infinitely-small (as far as our collision structures are concerned) points. We do not have a ready support for it. You...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Where can I find distributive SimpleIP? I was searching, but there isn't anywhere It's SimpleIPC. It is part of FPC (you will find it inside FPC sources, and the installed FPC already has it precompiled). There are also examples of it inside FPC sources (packages/fcl-process/examples).

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Loading and saving a large file will always take a considerable time now. Once we handle binary format glTF (planned for later CGE release this year) it will be much faster (and will not require any CPU usage). One solution for now is to save the contents to your own binary format. If all you save is one PointSet with a large Coordinate node, then it may be quite easy, just dump Coordinate.FdPoint.Items into the file. Other solution would be to avoid intermediate file. From what I understand, you...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The important question is how to communicate between Python and Pascal code. I proposed a couple of options, but you need to choose yourself :) In general, this is a question outside of Castle Game Engine, but the answer is "of course, it is possible, using various methods". From what you write, probably using SimpleIPC unit from Pascal is something you should play with. See https://www.freepascal.org/docs-html/fcl/simpleipc/index.html for the description of FPC SimpleIPC unit. The FPC distribution...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The manual describes how to load VRML and animate it, see "getting started" https://castle-engine.io/documentation.php and the first 4 chapters of https://castle-engine.io/manual_intro.php . As for integrating with Java or Python -- this very depends on what exactly you want. If you just get initial parameters,then you can write a program using Pascal that gets the necessary parameters by command-line. That's trivial. For more involved ways, you could communicate between FPC and Java/Python using...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The space in the engine is limitless ? (distances in X, Y Z are limitless ?) There are no special limits on distances placed by Castle Game Engine. That said, nothing is really "limitless" on existing computers with finite memory :) As we represent most distances using the Single type, your distances should fit within it's range, which is huge: 3.4 × 10^38 (see https://www.freepascal.org/docs-html/ref/refsu5.html , https://en.wikipedia.org/wiki/Single-precision_floating-point_format ). Moreover,...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I guess I am calling this in the wrong way: SceneManager.Projection is read-only. (And we want to keep it read-only, as by default, binding X3D nodes like Viewpoint and OrthoViewpoint can change the projection type.) The best way to switch the projection type at runtime between perspective/orthogonal: In the stable engine version: override CalculateProjection in your own TCastleSceneManager descendant. In the engine version from GitHub ( https://github.com/castle-engine/castle-engine/), I just added...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    To make the BoundingBox visible -- yes, you need to code it yourself. Here's an example (untested, I extracted and simplified this code from https://github.com/castle-engine/view3dscene-mobile ). function CreateBoundingBoxScene(const Box: TBox3D): TCastleScene; var RootNode: TX3DRootNode; BoxGeometry: TBoxNode; Shape: TShapeNode; Transform: TTransformNode; begin BoxGeometry := TBoxNode.CreateWithTransform(Shape, Transform); BoxGeometry.Size := Box.Size; Shape.Shading := shWireframe; Transform.Translation...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Note that you don't need to reset Camera.Input, and you should not call CastleControl.Update explicitly ever. Just a call to Camera.SetView is Ok:) See also https://castle-engine.io/manual_load_3d.php#section_camera You can also use CameraViewpointForWholeScene procedure from the CastleCameras unit to automatically calculate position/dir/up adjusted to the bounding box. This is what view3dscene is using for the defaults viewpoints in menu "Jump to Viewpoint".

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Note that if you move the vehicle by code, you can also update the camera by code. That is, you can use OnUpdate event (see https://castle-engine.io/manual_quick_2d_game.php about events) and just call SceneManager.WalkCamera.SetView(...) there, every time, to update the camera to be "glued" to the vehicle. In this case, you don't need to worry about where is the Viewpoint node in X3D. So, there are many ways to do this :)

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The first Viewpoint node in the X3D file is automatically "bound", that is: "connected with camera". So if the Viewpoint node position is animated, the camera will move too. You can put a Viewpoint node together with a Box (or anything else) under one Transform, and this way indeed animate a cube and the camera will automatically move along with it. You can test animations for viewpoints e.g. in https://github.com/castle-engine/demo-models/blob/master/navigation/viewpoint_transform.x3dv (best to...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    About the saving, if I try with one model, it gives an error: This probably means that the CastleControl1.SceneManager.MainScene is nil (it was not initialized, or the scene was freed later). Check CastleControl1.SceneManager.MainScene <> nil earlier. In general, we would have to see the whole code to tell why it is nil :) As my previous answer says, it is also possible that you don't want to save the contents of the scene. It really depends what you want to save. If you do not edit the scene contents,...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    About the saving, if I try with one model, it gives an error: This probably means that the CastleControl1.SceneManager.MainScene is nil (it was not initialized, or the scene was freed later). Check CastleControl1.SceneManager.MainScene <> nil earlier. In general, we would have to see the whole code to tell why it is nil :) As my previous answer says, it is also possible that you don't want to save the contents of the scene. It really depends what you want to save. If you do not edit the scene contents,...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Save3d(CastleControl1.SceneManager.MainScene.RootNode, CastleSaveDialog1.URL); Indeed it should work, as Eugene writes. It can actually be shortened to "CastleControl1.SceneManager.MainScene.Save(CastleSaveDialog1.URL)". But note that it will only save one scene (the one set as MainScene). If you use the suggestion from my post (the one with AnotherScene), then you will have many scenes, so it will not be enough. We do not have any format for saving multiple scenes (yet -- we will introduce such...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The camera is at the position you have set by instructions like SceneManager.WalkCamera.SetView(...) or SceneManager.ExamineCamera.SetView(...) SceneManager.RequiredCamera/WalkCamera/ExamineCamera.Position := ...; If you don't set any camera position explicitly, then we will take the position from the Viewpoint node in the scene set as SceneManager.MainScene. There are various ways how create an X3D file with a Viewpoint node, e.g. you can export it from Blender (Blender's camera will determine Viewpoint),...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The Switch node is used to show one (at most) node from a number of children. It is a good solution when the number of your models is predefined at start, and you only want to show one (or none) at a given time. If you want to freely show/hide each model independently, and if you want to add/remove/transform models at runtime at zero cost, I would rather use a number of TCastleScene instances :) The code would look like the most basic example on https://castle-engine.io/manual_load_3d.php . You can...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Cool, I'm glad it worked!

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Is that a setting when nothing new is added no re-rendering needs to be done ? Indeed there is: AutoRedisplay. And indeed it is by default true for engine applications (because it's easier in some cases -- no need to call Invalidate explicitly, and most games do some continuous animation anyway, and other game engines do it too). But indeed it is false in view3dscene, and it explains the FPS differences you see. So you can try setting CastleControl1.AutoRedisplay := false. The AutoRedisplay field...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    I'm glad it works :) it seems that there is a zero point in the scene that is used for rotation ? can this be set to the center of the scene ? If you recreate the camera after loading new scene, this should happen automatically. Note that you need to free the previous camera (SceneManager.Camera.Free) to force recreating camera. Or you can do it explicitly, without destroying the camera: SceneManager.ExamineCamera.ModelBox := SceneManager.Items.BoundingBox; The center of SceneManager.ExamineCamera.ModelBox...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I'm glad it works :) it seems that there is a zero point in the scene that is used for rotation ? can this be set to the center of the scene ? If you recreate the camera after loading new scene, this should happen automatically. Note that you need to free the previous camera (SceneManager.Camera.Free) to force recreating camera. Or you can do it explicitly, without destroying the camera: SceneManager.ExamineCamera.ModelBox := SceneManager.ExamineCamera.Items.BoundingBox; The center of SceneManager.ExamineCamera.ModelBox...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    can I assign colors per point too ? Sure :) To assign per-vertex color use Color node (or ColorRGBA if you need to assign also per-vertex alpha). The color nodes work much like Coordinate node, just a list of vectors, one for each point. They are mentioned on the previously linked page https://castle-engine.io/x3d_implementation_rendering.php , and the example shows them: https://github.com/castle-engine/demo-models/blob/master/x3d/points_colorrgba.x3dv . If I do this now, the scene is showing but...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The points in your code are not rendered, because the IndexedFaceSet is only for rendering polygons (with filled faces). It renders polygons defined in IndexedFaceSet.coordIndex, but when IndexedFaceSet.coordIndex is empty it renders nothing (regardless of the coordinates). To render points, place them in a PointSet. You can then save this node to file, or load it straight to TCastleScene without an intermediate file. I placed a complete example at the page https://castle-engine.io/x3d_implementation_rendering.php...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    The fastest and easiest is to use PointSet X3D node. See https://github.com/castle-engine/demo-models/blob/master/x3d/points_colorrgba.x3dv . You can write them in an X3D file or define the nodes using Pascal code, as always, see e.g. https://castle-engine.io/x3d_implementation_geometry2d.php for an example how to build X3D graph in Pascal. To control the size of the point, set TCastleScene.Attributes.PointSize. Note that this uses OpenGL(ES) rendering of points. So it's really fast (milions of points...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Hi, Happy that it's solved :) Notes: Since CGE 6.4, the more adviced name for T3DTransform is TCastleTransform. It also got a number of improvements in 6.4 release, see https://castle-engine.io/wp/2018/01/21/castle-game-engine-6-4-release-physics-ios-services-shader-pipeline-upgrade-big-api-improvements-vectors-transform-and-more/ and https://castle-engine.io/wp/2017/11/26/more-comfortable-transformation-of-scenes-fixed-function-disabled-by-default/ . It is possible to detect the clicks on each TCastleScene...

  • Michalis Kamburelis Michalis Kamburelis modified a comment on discussion General Discussion

    I committed a fix to CGE :) It is only a quick fix for now (not the larger change I want to eventually do, and have on my TODO list). But it should be enough for simple manifestations of this problem. I tested the fix on my testcase https://github.com/castle-engine/demo-models/blob/master/shadow_maps/primitives_with_commonsurfaceshader.x3dv . Please test with the latest CGE version from GitHub https://github.com/castle-engine/castle-engine/ . Of course please let me know if this still fails on your...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    I committed a fix to CGE :) It is only a quick fix for now (not the larger change I want to eventually do, and have on my TODO list). But it should be enough for simple manifestations of this problem. I tested the fix on my testcase https://github.com/castle-engine/demo-models/blob/master/shadow_maps/primitives_with_commonsurfaceshader.x3dv . Please test with the latest CGE version from GitHub https://github.com/castle-engine/castle-engine/ . Of course please let me know if this still fails on your...

  • Michalis Kamburelis Michalis Kamburelis posted a comment on discussion General Discussion

    Sorry it's taking so long -- it was a busy week :) I have this on my TODO list, I want to generally improve how shadow maps are activated while fixing this.

1 >