首页 \ 问答 \ Xtext 2.9 RuntimeModule(Xtext 2.9 RuntimeModule)

Xtext 2.9 RuntimeModule(Xtext 2.9 RuntimeModule)

我试图在我的dsl(名为ADSL)中实现隐式导入机制。 为此,我遵循大约3年前应用于SmallJava示例的方法,该方法可在此处获得: SmallJava源文件夹 。 我的dsl与SmallJava非常相似,所以您可能会认为我现在尝试在SmallJava中完成相同的操作。

我已经定义了一个库(类似于smalljava)并试图为它实现隐式导入。 为此,我需要以类似于SmallJavaRuntimeModule.java的方式自定义ADSLRuntimeModule类。 但是,我注意到在源文件夹中的Xtext 2.9中,我的ADSLRuntimeModule是xtend,而不是java文件。

因此,当我尝试更新我的ADSLRuntimeModule.xtend时,我会遇到语法错误,正如您在屏幕截图ADSLRuntimeModule.xtend中看到的那样 。 它声明此位置不允许@Override。

有人可以解释一下我为什么会遇到这个错误,这个定制的正确方法是什么?

非常感谢


I am trying to implement implicit import mechanism in my dsl (named ADSL). To do this I am following the approach applied to SmallJava example some 3 years ago, which is available here: SmallJava source folder. My dsl is very similar to SmallJava, so you might consider that I'm now trying to do essentially the same thing done in SmallJava.

I have defined a library (similar to the one of smalljava) and tried to implement the implicit import for it. To do this I need to customize ADSLRuntimeModule class, in a similar way to SmallJavaRuntimeModule.java. However, I notice that in Xtext 2.9 in the source folder my ADSLRuntimeModule is xtend, not java file.

So, when I try to update my ADSLRuntimeModule.xtend I experience syntactic mistakes, as you can see in the screenshot ADSLRuntimeModule.xtend. It states that @Override is disallowed for this location.

Could someone please explain why I am facing this error and what is the correct way to do this customization?

Thanks a lot


原文:https://stackoverflow.com/questions/36891404
更新时间:2022-08-03 08:08

最满意答案

这不是一件简单的事情,因为你会遇到100k“字体纹理”的内存问题。 由于您需要100k文本元素,因此您需要管理几个难题。 我也遇到过类似的问题,并将一些技术混合在一起以使其发挥作用。 简单地说,你需要某种LOD(“细节水平”)来完成这项工作。 该设置可能如下所示:

  1. 使用BufferGeometry构建的THREE.ParticleSystem,其中每个位置都是一个文本位置
  2. 一个“高”的TextureAtlas,上面有256个图像,你可以动态分配你周围的图像(4096px x 4096px,256x256px图像)
  3. 至少有一个“lowres”TextureAtlas,你有16x16px的图像。 你事先准备好了。 与之前的大小相同,但是您有文本的所有预览图像,每个图像的大小为16x16px。
  4. 一个kdtree数据结构,使用nearestneighbour算法来确定相机附近的位置(同样http://threejs.org/examples/#webgl_nearestneighbour
  5. 子成像模块可以直接在GPU上连续替换高纹理: https//github.com/mrdoob/three.js/pull/4661
  6. 每个位置的索引,告诉它应该用于显示的TextureAtlas上的哪个位置

你知道我要去哪里。 以下是一些关于我的经历的文档:

Stackoverflow帖子: 在three.js中显示数千个图像我(开始)解释我在做什么的博客: http//blogs.fhnw.ch/threejs/

这样,在获得满意的结果之前需要相当长的时间。 使这个更简单的唯一方法是摆脱16x16px预览图像。 但我不建议......或者当然取决于你的设置。 也许你有水平? 城市? 或者只显示这些文本的一部分有意义的任何其他结构? 在处理大事之前,这可能是值得的。 如果您打算真正开展这项工作并按照我所描述的方式实现这一点,我可以帮助您解决一些现有的代码和进一步的解释。 告诉我你要去哪里:)


This is no simple matter since you'll run into memory issues with 100k "font textures". Since you want 100k text elements you'll have several difficulties to manage. I had a similar problem too once and tossed together a few techniques in order to make it work. Simply put you need some sort of LOD ("Level of Detail") to make that work. That setup might look like following:

  1. A THREE.ParticleSystem built up with BufferGeometry where every position is one text-position
  2. One "highres" TextureAtlas with 256 images on it which you allocate dynamically with those images that are around you (4096px x 4096px with 256x256px images)
  3. At least one "lowres" TextureAtlas where you have 16x16px images. You prepare that one beforehand. Same size like previous, but there you have all preview images of your text and every image is 16x16px in size.
  4. A kdtree data structure to use a nearestneighbour algorithm with to figure out which positions are near the camera (alike http://threejs.org/examples/#webgl_nearestneighbour)
  5. The sub-imaging module to continually replace highres textures with directly on the GPU: https://github.com/mrdoob/three.js/pull/4661
  6. An index for every position to tell it which position on the TextureAtlas it should use for display

You see where I'm going. Here's some docs on my experiences:

The Stackoverflow post: Display many thousand images in three.js The blog where I (begun) to explain what I was doing: http://blogs.fhnw.ch/threejs/

This way it will take quite some time until you have satisfying results. The only way to make this simpler is to get rid of the 16x16px preview images. But I wouldn't recommend that... Or of course something depending on your setup. Maybe you have levels? towns? Or any other structure where it would make sense to only display a portion of these texts? That might be worth a though before tackling the big thing. If you plan to really work on this and make this happen the way I described I can help you with some already existing code and further explanations. Just tell me where you're heading :)

相关问答

更多
  • 原因 第二个纹理未渲染的原因是因为它不知道将第一个或第二个材质分配到哪个面,因此默认情况下它会为所有这些材质提供第一个材质。 解 将Three.js更新为最新版本(r76)。 你现在正在运行r54 遍历所有面并为它们指定materialIndex ( Face3 ) 使用THREE.MultiMaterial而不是THREE.MeshFaceMaterial : mesh2 = new THREE.Mesh(geometry2, new THREE.MultiMaterial( materials )); ...
  • 试试这个(未经测试): // instantiate a loader var loader = new THREE.TextureLoader(); // Create material var material = new THREE.MeshBasicMaterial({side: THREE.DoubleSide}); // load a resource loader.load('imgs/birdtexture.jpg', function (texture) { ...
  • 将视频视为一系列图像。 因此,要在3D对象上“播放”此视频 - 您必须将该序列的每一帧传递到您的素材,然后更新该素材。 好的起点是: https : //github.com/mrdoob/three.js/wiki/Updates 在这里: http : //stemkoski.github.io/Three.js/Video.html Think of video as a sequence of images. So to "play" this video on your 3D object - y ...
  • 如果数据已经在您的Javascript代码中,那么最佳方法是使用DataTexture - 请参阅https://threejs.org/docs/#api/textures/DataTexture以获取常规文档,或者查看THREE.ImageUtils.generateDataTexture()用于制作它们的相当方便的方法。 http://threejs.org/docs/#Reference/Extras/ImageUtils The optimal way, if the data is alread ...
  • ParticleSystem仅支持系统中所有粒子的单个纹理,并且所有粒子共享该纹理。 ParticleSystem only supports a single texture for all particles in the system, and all particles share that texture.
  • ......就像我决定在这里发帖一样,我通过添加material.map.minFilter = THREE.LinearFilter;解决了我的问题material.map.minFilter = THREE.LinearFilter; … And just as I decide to post here I solved my issue, by adding material.map.minFilter = THREE.LinearFilter;
  • 我按照这个链接,它对我有用。 我必须为纹理做一个小的chnages才能使它正确。 texture.wrapS = texture.wrapT = THREE.MirroredRepeatWrapping; texture.offset.set(0.5, 0.5); 希望这对某人也有帮助。 I followed this link and it worked for me. I had to do one minor chnages to the texture to get it right. textu ...
  • 你有几个警告,你应该先解决。 color不是THREE.ShaderMaterial一个属性。 THREE.GeometryUtils.merge(geometry, plane); 已被移动到Geometry上的API。 等等 我已将代码剥离成可在此运行的简单片段(因为我们无法访问您的纹理文件)。 从我的变化中完全失去了一些东西: 我删除了你的初始画布。 您可以稍后替换它。 请注意,我在WebGLRenderer参数中添加了{ alpha: true } 。 这允许渲染器画布后面的任何内容显示。 我看到你 ...
  • 这不是一件简单的事情,因为你会遇到100k“字体纹理”的内存问题。 由于您需要100k文本元素,因此您需要管理几个难题。 我也遇到过类似的问题,并将一些技术混合在一起以使其发挥作用。 简单地说,你需要某种LOD(“细节水平”)来完成这项工作。 该设置可能如下所示: 使用BufferGeometry构建的THREE.ParticleSystem,其中每个位置都是一个文本位置 一个“高”的TextureAtlas,上面有256个图像,你可以动态分配你周围的图像(4096px x 4096px,256x256px ...
  • 以下是应用了纹理的3D文本示例: http://stemkoski.github.io/Three.js/Text3D-Textures.html 希望能帮助到你! Here is an example of 3D text with a texture applied: http://stemkoski.github.io/Three.js/Text3D-Textures.html Hope it helps!

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。